Windows Ping Script!

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

I'm having an issue that has plagued me every time I try to use a ping script. If I let it run for long enough, I'll eventually open up Task Manager and find about 20 cmd.exe (and now 20 tping.exe's too!) I was one of the ones asking for a more Unix-like ping script thinking that it would end on its own should it not complete successfully.

I'm pinging about 20 hosts every cycle. Does nobody else experience this? If not, any ideas where I've gone wrong here? There aren't too many gaps in my graphs, so I know that it's getting data back a strong majority of the time. For whatever reason though, sometimes the script just hangs. Misora, please don't think I'm griping about your script... I still think it is very cool!! I just seem to have general scripting problems.

What are other Windows folks doing to make sure they don't get a build up of hung processes???

thanks!
jason
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I could write a PHP Script Server replacement for tping if you all want me too. It will also run faster I think.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

I'd be a very happy beta tester for you. :)

My boss liked what I was doing and hit me up for the infamous availability reports today. Viewable over a user-defined window of time over a history as far back as 18 months. "umm... sure... no prob." :) I was just looking for a good spot to hook in and start dumping pass/fail data into a SQL table.

So for me personally, that'd fit like a glove. Wait and see if you get more interest tho...

Jason
jenchingyang
Posts: 18
Joined: Wed Jul 20, 2005 8:44 am

Import cacti_graph_template_network_ping.xls failed

Post by jenchingyang »

When I try to install cacti_graph_template_network_ping. I got follow error message. What's wrong? Error: XML: Generated with a newer version of Cacti.
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

Believe that I read in another post the other day that templates are not backwards compatible. Misora did the export on 0.8.6f so perhaps you are running an older version?

Jason
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

I had to make sure I wasn't lying in my previous post.

From this page: http://forums.cacti.net/viewtopic.php?t ... c&start=45
Import/Export is not currently supported between versions. With the pending 0.9 changes, that's a good thing too.

TheWitness
Jason
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

I found a workaround for my hung process problem...

What I did is here: http://forums.cacti.net/viewtopic.php?p=37470#37470

Jason
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Hi all. Here is the buildin version of the ss_tping.php program. Does not hang and does not require tping.exe. This one will work on Unix as well. It defaults to "6" retries. If you want more or less, edit the php file. It also does not specify either TCP/UDP/SNMP types. This would be a great enhancement to the script if anyone wants to take it on. You could ping Port 80 for example if it's a web server.

To install, simply replace your existing ss_tping.php

Someone please let me know how it performs.

Thanks,

TheWitness :)

EDIT: Don't like that file size. Oh well.
Attachments
ss_tping.zip
(666 Bytes) Downloaded 987 times
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

Awesome! Just installed (replaced ss_tping.php)... It made it through a couple of cycles... Seemed to have stopped graphing and left a flurry of these entries in the cacti log now:

Code: Select all

The PHP Script Server did not respond in time and will therefore be restarted 
and

Code: Select all

PHP Script Server communications lost, attempting to close and restart 
It's in the scripts folder... Verified that the include files you specified are in the /lib folder... Still looking, but nothing obvious is jumping out.

Off topic, but do you have an Amazon (or other) wishlist out there?

Jason
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

Narrowed it down some... Ran from cmd prompt and it returned:

Code: Select all

Fatal error: Call to undefined function socket_create() in C:\apachefriends\xampp\cacti\lib\ping.php on line 99
jas
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You need to make the following modification to your PHP.INI file:

Windows:

Code: Select all

extension=php_sockets.dll
Unix

Code: Select all

extension=php_sockets.so
In Unix, you may have to remake PHP. Using Sockets is a part of the Cacti installation instructions.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

Thanks bud, that took care of the PHP prob. I've done several cycles and am pretty much covering the spectrum on possible results though. :)

I'm doing a total of 22 pings each cycle to different routers. Looks like 6 of them stopped charting.

I have two that are on the same LAN as the Cacti box that have jumped from 1 - 2 ms to 80 - 90 ms

I have two on the WAN that dropped to an (unfortunately) impossible low of 2 - 7ms

There are a couple that are reasonably close to what they were before.

The remainder all took either roughly a 30 - 50ms gain or 30 - 50ms loss.

Everything mentioned above has been steady on a per-device basis (the ones pinging too low are being consistent, as are the high ones).

I was using a 32B packet with the tping program, but given that some are now high and some are low, I'm doubting that is relevant. I'm pretty comfortable with the ping times I was receiving before... They always seemed to jive up with doing a simple ping from a cmd window (32B).

Anything I could do to track this down?

Thanks again,
Jason
a2line59
Posts: 45
Joined: Mon May 23, 2005 8:20 am
Location: France

Post by a2line59 »

it's exactly that i search so i tried it
i unzip php file into my cacti directory
i unzip tping.exe into my windows directory
i patched files for the script server bug
and when i want to import xml into cacti i have this message :
"Error: XML: Hash version does not exist."

for each reasons i have this error ? i made exactly that Misora said in this post

i use cacti 0.8.6c on a windows 2000 professionnal
php 4.3.11 and mysql 4.1.11
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

The template was created in Cacti 0.8.6f. You need to be at that version. Sorry.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jas0420
Cacti User
Posts: 91
Joined: Thu Jan 13, 2005 3:58 pm
Location: College Station, TX - USA

Post by jas0420 »

I'm still working on this, but wanted to pass along a couple of things.
found that if I manually run the new php ping script individually from a DOS window, all router response times are dead-on accurate.

Found that when I used the original Data Input Method's Input String with the new php ping script, I seem to be getting two responses. One is a valid time, the other a "U".

Orriginal Input String:

Code: Select all

<path_cacti>/scripts/ss_tping.php ss_tping<hostname>
07/21/2005 09:20:05 AM - PHPSVR: Poller[0] SERVER: C:\apachefriends\xampp\cacti/scripts/ss_tping.php ss_tping 10.80.100.2 output AV:2.2566666666667 PL:0
This log entry was a few lines above (a split-second more recent) than the previous one with the correct ping time.
07/21/2005 09:20:05 AM - CACTID: Poller[0] Host[39] DS[1909] SERVER: C:\apachefriends\xampp\cacti/scripts/ss_tping.php ss_tping 10.80.100.2, output: U
I tried to mock that input string from a command prompt and got the following response:
C:\apachefriends\xampp\cacti\scripts>php ss_tping.php ss_tping 10.90.20.1
#!/usr/bin/php -q

Warning: Division by zero in C:\apachefriends\xampp\cacti\scripts\ss_tping.php on line 44
AV:U PL:100
Tried changing the Input String to the following and clearing the Poller Cache, but only get "U"'s so I'm obviously not following the logic of the Input String formating.

Code: Select all

<path_cacti>/scripts/ss_tping.php <hostname>
Also tried this which was what I was successfully doing it from the command prompt with:

Code: Select all

<path_cacti>/scripts/php ss_tping.php <hostname>
Jason
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests