Script that needs to return NaN for a value

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
BigWillyStyle42
Posts: 11
Joined: Tue Mar 14, 2006 11:13 am

Script that needs to return NaN for a value

Post by BigWillyStyle42 »

I have a script that pings two hosts (one IPv4, one IPv6) and then returns the values. Occassionally my IPv6 connection will drop, but I'd like my IPv4 latency to still be graphed, and the IPv6 latency to become NaN until it recovers.

By default the script returned the following in that case:

Code: Select all

ping4:24.5 ping6:
To which cacti replies

Code: Select all

01/03/2007 02:25:02 AM - CMDPHP: Poller[0] Host[1] DS[20] WARNING: Result from CMD not valid.  Partial Result: ping4:8.50 ping6
When I realized that wasn't working I added a check to change the value to NaN since that is what is displayed in the graphs, but that produces the same output in the cacti log. Read another post here that mentioned that the value should be "U" so I tried that, but that also produces the exact same output.

So the question is, what is the magic output I need to produce to get NaN put into the rrd?

I'm using cacti 0.8.6i.
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

ping4:24.5 ping6:U
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?
BigWillyStyle42
Posts: 11
Joined: Tue Mar 14, 2006 11:13 am

Post by BigWillyStyle42 »

That's exactly what it currently returns. Tried with cmd.php and cactid and both give the error shown in the first post.
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Unfortunately, I you look more closely, you will find that you are missing the
:U
Once you include this, you should be all set.

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?
BigWillyStyle42
Posts: 11
Joined: Tue Mar 14, 2006 11:13 am

Post by BigWillyStyle42 »

Actually that is being truncated by cacti in the log. I've now modified the script so that it always prints the following:

Code: Select all

ping4:U ping6:U
And here are the corresponding items in the log:

Code: Select all

01/03/2007 05:20:02 AM - CMDPHP: Poller[0] Host[1] DS[20] CMD: /bin/bash /usr/share/cacti/site/scripts/2ping, output: U
01/03/2007 05:20:02 AM - CMDPHP: Poller[0] Host[1] DS[20] WARNING: Result from CMD not valid. Partial Result: ping4:U ping6
So it seems to accept the first, but not the second.
Attachments
2ping.sh
Modified script
(291 Bytes) Downloaded 196 times
User avatar
TheWitness
Developer
Posts: 17004
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Hmm, let me think about this. Tell me then, when you get the "U" does the other value update correctly? Please advise. If not, it's a bug. Otherwise, it would appear we have a problem. Let me know and I will do what I can.

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?
BigWillyStyle42
Posts: 11
Joined: Tue Mar 14, 2006 11:13 am

Post by BigWillyStyle42 »

The following results work correctly in updating the RRA:

Code: Select all

ping4:10 ping6: 20
ping4:U ping6:20
These both result in an error:

Code: Select all

ping4:10 ping6:U
ping4:U ping6:U
I also tried the following which seems to update ping4/ping6 properly when ping6 is unknown:

Code: Select all

ping4:10 ping6:U dummy:4
So it seems like the last result cannot be unknown.
BigWillyStyle42
Posts: 11
Joined: Tue Mar 14, 2006 11:13 am

Post by BigWillyStyle42 »

Would you like me to file a bug report for this? I can use the hack of adding a 3rd result that is defined for the time being, but obviously it'd be better if it was fixed.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests