Windows Ping Script!
Moderators: Developers, Moderators
Windows Ping Script!
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.
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
-
- tping.zip
- (27.91 KiB) Downloaded 8929 times
-
- cacti_graph_template_network_ping.xml
- (21.94 KiB) Downloaded 8629 times
-
- Cacti User
- Posts: 63
- Joined: Mon Jul 04, 2005 10:12 am
- Location: Brazil
Re: Windows Ping Script!
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
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.
-
- Cacti User
- Posts: 63
- Joined: Mon Jul 04, 2005 10:12 am
- 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
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
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!!!!
-
- Cacti User
- Posts: 63
- Joined: Mon Jul 04, 2005 10:12 am
- 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
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?
-
- Cacti User
- Posts: 63
- Joined: Mon Jul 04, 2005 10:12 am
- 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
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!!???
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,
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,
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:
This is using the default delay. Tping does not have a preloading option like linux, however you can set something like...
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
You'll see this in the script:
Code: Select all
$output = shell_exec("tping.exe -n 6 -l 64 -w 400 " . $target);
Code: Select all
$output = shell_exec("tping.exe -n 7 -l 64 -d 0 -z 1 -w 400 " . $target);
Hopefully this helps,
Misora
-
- Posts: 16
- Joined: Thu Jul 14, 2005 8:55 am
???
getting this error even after following all your directions:
ERROR: Not enough arguments
Ideas?
ERROR: Not enough arguments
Ideas?
Who is online
Users browsing this forum: No registered users and 0 guests