ping response on win2k

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
lucky
Cacti User
Posts: 62
Joined: Mon Sep 30, 2002 3:23 am
Location: Germany

ping response on win2k

Post by lucky »

hi,

i am trying to make ping response graphs on a win2k server....

i can not use the ping.pl

is there a way to do it on a win2k server??

thx for help
MontyP
Posts: 13
Joined: Mon May 12, 2003 9:56 am
Location: Canada
Contact:

Post by MontyP »

I would also apprciate some help on this. I've searched the forum here w/o any luck. If someone has this working please post your solution with details.

TIA
Antoon

ping

Post by Antoon »

I wrote a VBS script :

Dim oArgs, Answer, fso

Set oArgs = WScript.Arguments
If oArgs.Count <> 1 Then Wscript.Quit(0)

Set MyShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

Const TempFile = "./ping.txt"

Program = "%comspec% /c ping.exe -n 1 " & oArgs(0) & " >" & TempFile
Return = MyShell.Run(Program,0,True)
Set MyFile = fso.OpenTextFile(TempFile)
Answer = MyFile.ReadAll
MyFile.Close()
'Set MyFile = fso.GetFile(TempFile)
'MyFile.Delete

If InStr(Answer,"ytes=") Then
p= InStr(Answer,"Average")
Wscript.StdOut.Write Val(Trim(Mid(Answer,p+10,10)))
Else
Wscript.StdOut.Write "0"
End If

Wscript.Quit(0)

function Val(vValue)
Dim lCount
Dim lResult
Dim strResult
if len(vValue) = 0 Then
lResult = 0
Else
if isnumeric(vValue) Then
lResult = cdbl(vValue)
Else
lCount = 1
Do until (isnumeric(mid(vValue,lCount,1))=false) or (lCount > len(vValue))
strResult = strResult & mid(vValue, lCount, 1)
lCount = lCount + 1
Loop

if len(strResult) = 0 Then
lResult = 0
Else
lResult = cdbl(strResult)
End if
End if
End if
Val = lResult
End function
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests