Advanced Ping Template for Cacti 0.8.6f

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

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

Post by TheWitness »

Donations are always welcome. They would be for my kids.

Larry
Attachments
ss_fping.zip
(1.1 KiB) Downloaded 1145 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?
fanu
Posts: 18
Joined: Thu Oct 07, 2004 2:53 pm
Location: Paris, France

Post by fanu »

Give us a wishlist ! :wink:

Thanks a lot !

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

Post by 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?
fanu
Posts: 18
Joined: Thu Oct 07, 2004 2:53 pm
Location: Paris, France

Post by fanu »

Re-Hello,

I put the new ss_fping. It seems to be better, but there is still a problem :
when the first packet is lost, the script does not stop (same problem).

What can I do to help you to resolve this ?

Thanks for your help.

Fanu.
fanu
Posts: 18
Joined: Thu Oct 07, 2004 2:53 pm
Location: Paris, France

Post by fanu »

Hello,

In addition to my last message, I have done some tests. I set in hard in the script the timeout value to 10 ms. I try to ping www.google.com (about 20ms) and it works : I think my problem is that the ss_fping script (maybe the call to Net_Ping();) never time out. So if there is a lost packet, the script never ends.

Thanks for your help.

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

Post by TheWitness »

fanu,

This may be the issue within the ping.php program caused by the set_scoket_option command. Look for it and then review the timeout issues. In some versions of PHP, it acutally works properly. But in windows (where I code) it does not work as expected.

Read the comments on seconds and microseconds. I think you just have to reverse the order and it will work properly. Try that and let me know.

I could write some detection logic to compare unix vs. windows and modify the commands, but I am not sure what platforms PHP is broken on.

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?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Here is the code:

Code: Select all

/* set the socket timeout */
socket_set_option($this->socket,
  SOL_SOCKET,  // socket level
  SO_RCVTIMEO, // timeout option
  array(
  "sec"=>$this->timeout,  // I assume timeout in microseconds
  "usec"=>0 // Timeout in seconds
));
It would be changed to:

Code: Select all

/* set the socket timeout */
socket_set_option($this->socket,
  SOL_SOCKET,  // socket level
  SO_RCVTIMEO, // timeout option
  array(
  "sec"=>0,  // I assume timeout in microseconds
  "usec"=>$this->timeout // Timeout in seconds
));
It occurs in a few places. Please let me know.

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?
fanu
Posts: 18
Joined: Thu Oct 07, 2004 2:53 pm
Location: Paris, France

Post by fanu »

Hello,

Thank you for your response.
I try to do what you wrote but the problem is still here.
I try to force the timeout to 10ms in the ss_fping script but the directive seems to be ignored (I ping some hosts with 300ms of latency, but if there is a packet loss, the script still never end).
I don't know where to search ...

Thank you for your help.

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

Post by TheWitness »

I have a new version of ping.php attached. Please test ss_fping.php especially using UDP pings if you can spare the testing time. Timeouts work like they should now. I abandoned the set option call for the socket select, which appears to be much better developed.

TheWitness
Attachments
ping.zip
(2.92 KiB) Downloaded 1408 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?
fanu
Posts: 18
Joined: Thu Oct 07, 2004 2:53 pm
Location: Paris, France

Post by fanu »

It works!
Thank you very much for this update.
Everything seems to be fine now.

Merci beaucoup !!!

Fanu.
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Post by JJX »

I am using the script but always i get 100% packet loss! (even to lan)
nothing weird to the logs...
any idea?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

JJX,

What Ping method? Have you loaded the sockets.so PHP extension?

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?
lightningbit
Posts: 26
Joined: Fri Sep 30, 2005 4:23 am

Post by lightningbit »

lard wrote:Isn't it amazing after searching forums e.t.c. and then posting a query....you answer it yourself within minutes???!! :evil:

Turns out that after chacking the data template for advanced ping the "per device hostname" field was checked.... :oops: ....after unchecking and adding the data template to an existing host it then asked me for the IP to poll..

I'll go and turn it back to snmp-reliable now :wink:

Lard
can you explain a bit more?
I'm playing around with this, but didn't find exactly what you are talking about....
User avatar
foxtratz
Posts: 14
Joined: Thu Sep 29, 2005 12:03 am
Location: Cagayan de Oro,Philippines
Contact:

call to undefined function socket_create() ???

Post by foxtratz »

When I tried to run this:

PHP Script Server has Started - Parent is cmd
scripts/ss_fping.php ss_fping www.google.com 20 TCP 80

Fatal error: Call to undefined function: socket_create() in /usr/local/cacti-0.8.6g/lib/ping.php on line 298

Im using cacti 0.8.6g and applied the latest ss_fping.zip and ping.zip from this thread but still no luck. :-(. Im running on SuSE 9.3 OS
"Knowledge is Power"
User avatar
foxtratz
Posts: 14
Joined: Thu Sep 29, 2005 12:03 am
Location: Cagayan de Oro,Philippines
Contact:

Post by foxtratz »

Its ok now! :-) I just need the PHP-SOCKETS service. :lol:
"Knowledge is Power"
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests