Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Apr 24, 2019 9:12 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Windows Ping Script!
PostPosted: Fri Jul 15, 2005 3:57 am 
Offline

Joined: Thu Jul 14, 2005 2:35 pm
Posts: 7
Several people seem to be looking for a windows ping script so I finally have written one. Actually, I just started using cacti yesterday and stayed up a large portion of last night getting it to work. At about 4 am I decided to write a windows ping script and finished it up the latter part of today, there were some things I had to work out.

Details: It uses tping (a windows application) to send out 6 pings, which time out after 400 ms (you're welcome to change these values in the script). It returns average rtt within two decimal points of accuracy. It also returns packet loss and uses a slight modification of the graph from this thread: http://forums.cacti.net/viewtopic.php?t=6900

Tping can be found here (if you're interested, I already included it in the zip): http://sourceforge.net/projects/tping/
If you did download tping, I can only promise that version 1.11 will parse correctly.

This has only been tested on cacti 0.8.6f, and needs the patch from this thread for the php script server: http://forums.cacti.net/viewtopic.php?t=8494

Install Instructions:

1. Open the tping.zip archive, unzip the php file into [Cacti Directory]\scripts.
2. Unzip tping.exe into c:\windows (or your windows directory).
3. Make sure your files have been pached for the script server bug.
4. Import the xml into cacti.
5. Choose any device and add the 'Network - Ping' graph. You can choose a hostname or ip address at this point.
6. Wait two cycles (600 seconds) for the graph to update.
7. Yay, you're done.


Attachments:
cacti_graph_template_network_ping.xml [21.94 KiB]
Downloaded 7940 times
tping.zip [27.91 KiB]
Downloaded 8488 times
Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 4:00 am 
Offline

Joined: Thu Jul 14, 2005 2:35 pm
Posts: 7
Example Picture.


Attachments:
File comment: Ping times to google after a short bit of testing.
googleping.png
googleping.png [ 25.51 KiB | Viewed 73714 times ]
Top
 Profile  
 
 Post subject: Re: Windows Ping Script!
PostPosted: Fri Jul 15, 2005 6:43 am 
Offline
Cacti User

Joined: Mon Jul 04, 2005 10:12 am
Posts: 63
Location: Brazil
Misora, fantastic work! I just tried it on my Apache 1.3.27/PHP 4.3.11/MySQL 4.1.11/Cacti 0.8.6f + script server patch Windows 2000 server and it works great!
Just in case somebody doesn't know what patch needs to be applied, please refer to the following topic:
http://forums.cacti.net/viewtopic.php?p=37099

Georger

Misora wrote:
Several people seem to be looking for a windows ping script so I finally have written one. Actually, I just started using cacti yesterday and stayed up a large portion of last night getting it to work. At about 4 am I decided to write a windows ping script and finished it up the latter part of today, there were some things I had to work out.

Details: It uses tping (a windows application) to send out 6 pings, which time out after 400 ms (you're welcome to change these values in the script). It returns average rtt within two decimal points of accuracy. It also returns packet loss and uses a slight modification of the graph from this thread: http://forums.cacti.net/viewtopic.php?t=6900

Tping can be found here (if you're interested, I already included it in the zip): http://sourceforge.net/projects/tping/
If you did download tping, I can only promise that version 1.11 will parse correctly.

This has only been tested on cacti 0.8.6f, and needs the patch from this thread for the php script server: http://forums.cacti.net/viewtopic.php?t=8494

Install Instructions:

1. Open the tping.zip archive, unzip the php file into [Cacti Directory]\scripts.
2. Unzip tping.exe into c:\windows (or your windows directory).
3. Make sure your files have been pached for the script server bug.
4. Import the xml into cacti.
5. Choose any device and add the 'Network - Ping' graph. You can choose a hostname or ip address at this point.
6. Wait two cycles (600 seconds) for the graph to update.
7. Yay, you're done.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 7:11 am 
Offline
Cacti User

Joined: Sat Jul 09, 2005 3:13 pm
Posts: 142
guys i just did all that but can't get any graph. i ran it manually this is what i get.

C:\Inetpub\wwwroot\cacti\scripts>php ss_tping.php ss_tping 4.2.2.2
Windows Socket Unable to Resolve Host ss_tping
AV: PL:

i got a winnt box | cacti 8.6f | cactid 8.6e | php504 | rrdtool 1049 | mysql4112a


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 7:32 am 
Offline
Cacti User

Joined: Mon Jul 04, 2005 10:12 am
Posts: 63
Location: Brazil
This is not how it's supposed to be used - that PHP file belogs in the /scripts directory, and tping.exe should go to, say, C:\WINNT\SYSTEM32. You should also allow the poller script to run twice in order to get some data. By the way, why are you using Cactid? Many hosts? I use cmd.php and it works just fine.
Do EXACTLY as Misora instructs and all should be fine. Regards,

Georger

flipflap wrote:
guys i just did all that but can't get any graph. i ran it manually this is what i get.

C:\Inetpub\wwwroot\cacti\scripts>php ss_tping.php ss_tping 4.2.2.2
Windows Socket Unable to Resolve Host ss_tping
AV: PL:

i got a winnt box | cacti 8.6f | cactid 8.6e | php504 | rrdtool 1049 | mysql4112a


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 7:48 am 
Offline
Cacti User

Joined: Sat Jul 09, 2005 3:13 pm
Posts: 142
the php script is in the cacti scripts directory also tping is in the WINNT directory. that's the problem i just did exactly what he said but can't get any graphs. this is killing me need help badly. maybe i'm jinxed :(. BTW i use cmp.php i just installed cactid as an alternate poller just in case. HELP!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 7:49 am 
Offline
Cacti User

Joined: Sat Jul 09, 2005 3:13 pm
Posts: 142
i got this on the input string

<path_cacti>/scripts/ss_tping.php ss_tping <hostname>

is that correct?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 8:28 am 
Offline
Cacti User

Joined: Mon Jul 04, 2005 10:12 am
Posts: 63
Location: Brazil
Yes, it is.
How did you create your graph? After installing tping, the script server fix and graph template, I created mine like this:

1. Click Devices. Click the device for which you want to create the ping graph.
2. Click Create Graphs for this Host.
3. On Graph Templates, pick Network - Ping and click the "create" button.
4. On the Legend Text field, type some description, e.g. "ADSL Router". On the Hostname / IP field, type the IP address of your device, e.g. "192.168.1.254". It goes without saying that you shouldn't use quotes when filling the fields. Click the "create" button.
5. Click Graph Management - your graph should be there. Click it - it probably doesn't contain a graph yet, but after two polls it will. Be patient.

Hope this helps. Regards,

Georger

flipflap wrote:
i got this on the input string

<path_cacti>/scripts/ss_tping.php ss_tping <hostname>

is that correct?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 8:38 am 
Offline
Cacti User

Joined: Sat Jul 09, 2005 3:13 pm
Posts: 142
got it working now. just deleted the network-ping data query or something and installed it again. thanks for the great tool

Who's your momma now?!?!?!?! or daddy!!??? :wink:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 9:35 am 
Offline
Cacti User

Joined: Mon Jul 04, 2005 10:12 am
Posts: 63
Location: Brazil
What kind of question is that? I was trying to help you.
I explained in such great detail because, looking at your previous posts, you look like a novice in LAMP applications. Furthermore, I'm not trying to help you exclusively - many other people will read this topic and at least one of them will save some time following my advice.

Georger

flipflap wrote:
got it working now. just deleted the network-ping data query or something and installed it again. thanks for the great tool

Who's your momma now?!?!?!?! or daddy!!??? :wink:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 9:53 am 
Offline
Cacti User

Joined: Sat Jul 09, 2005 3:13 pm
Posts: 142
hey i meant that as a complement to you and the guys who did this script. like saying you're the man. i meant no disrespect. sorry if you interpret things that way :( .

ok to be more direct. thanks you for taking some time off to help a novice guy like me. hope that helps :D


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 12:55 pm 
Offline

Joined: Fri Jul 15, 2005 6:35 am
Posts: 5
Misora,

Thanks for a great addon. I've tested it on some long-delay (satellite) links and I noticed that I always got a yellow color on the graph for the first ping to be lost or so (?). To avoid this adjusted the default 400ms timeout to 1000ms, but then I think i ran into some problems with my overall graphing. My question is, since we're pushing out 6 pings, what happens let's say when this long-delay link is down? Do we need to wait for 6 x timeout? Could the 6 pings have been pushed out simultaneously instead? Maybe with smaller packets? Well.. I guess this is maybe up to me to tune in but I was just curious to know if you had any considerations about this.

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 3:46 pm 
Offline

Joined: Thu Jul 14, 2005 2:35 pm
Posts: 7
You can take a look at the tping options if you wish to change them. The php script is rather easy to change...

You'll see this in the script:
Code:
$output = shell_exec("tping.exe -n 6 -l 64 -w 400 " . $target);


This is using the default delay. Tping does not have a preloading option like linux, however you can set something like...

Code:
$output = shell_exec("tping.exe -n 7 -l 64 -d 0 -z 1 -w 400 " . $target);


This will set delay between pings to 0. It will send out 7 pings total at 64 bytes. Also, it will ignore the first ping in the calculation and will wait 400 ms for time-out.

Hopefully this helps,
Misora


Top
 Profile  
 
 Post subject: ???
PostPosted: Mon Jul 18, 2005 10:17 am 
Offline

Joined: Thu Jul 14, 2005 8:55 am
Posts: 16
getting this error even after following all your directions:

ERROR: Not enough arguments

Ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 8:15 pm 
Offline
Cacti User

Joined: Thu Jan 13, 2005 3:58 pm
Posts: 91
Location: College Station, TX - USA
Great stuff Misora... Worked like a champ. Thanks for sharing!

Jason


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google Adsense [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group