Script working fine, but graph not drawing properly.

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
hurgh
Posts: 13
Joined: Wed Oct 11, 2006 2:40 am
Contact:

Script working fine, but graph not drawing properly.

Post by hurgh »

Hi All,

I have written a script that gets the wind speed off a website, in both KM/h and Knots.

The script returns the values as follows:

Code: Select all

speedkm:23 SpKN:12
So speedkm is the speed in KM/h (23) and SpKN is the speed in Knots (12).

I have watched the poller output and this is the relevant line:

Code: Select all

10/11/2006 05:35:08 PM - CACTID: Poller[0] Host[17] DS[149] SCRIPT: /var/www/html/cacti/scripts/wind.pl, output: speedkm:11 SpKN:6
So as you can see, it is running the script and the proper values are being returned.

So I have setup the Data Input Method, with both the output fields labeled correctly, I have setup a Data Template, using both the output fields in separate data source items, and then I setup a Graph Template.

This is the part that does not seem to be working.

I wanted to be tricky and have 2 lines, one for KM/h and one for Knots.

So i setup the Graph template, added Line1 as the speed_km and then Line2 as the speed_knots (as well as some gprints).

Last, I added a device using the new graph template, and waited for a few runs to happen, then checked the graph, and it drew half ok.

It draws the speed_knots line, but not the speed_km line, and for the gprint values at the bottom of the graph (i have last, average, and max for both lines), it shows that speed_knots has the correct values, but speed_km values are set to "nan" indicating to me that it cant get the values.

I can upload my exported templates and any other relevant info if needed, but I am really after some help on how to work out where the issue is and then how to fix it.

Is there commands I can run to find out if the data that is being received from the script is being parsed correctly and then put into the RRD files?

How can I tell where this is breaking?

Any help would be much appreciated.

-Hurgh-
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please find my link on "NaN Debugging" in my signature.
Reinhard
hurgh
Posts: 13
Joined: Wed Oct 11, 2006 2:40 am
Contact:

Post by hurgh »

Hi lvm,

Thanks for the guide, I have gone through it and think I might have located the problem, but am not sure how to fix it.

Everything is fine up until step 5. "Check rrd file numbers"

I run the command:

Code: Select all

rrdtool fetch <rrd file> AVERAGE
and the last few lines all have nan's in it:

Code: Select all

1160556000: nan 2.6666666667e-02
1160556300: nan 0.0000000000e+00
1160556600: nan 0.0000000000e+00
1160556900: nan 0.0000000000e+00
1160557200: nan 0.0000000000e+00
1160557500: nan 0.0000000000e+00
1160557800: nan 1.9933333333e+00
1160558100: nan 2.0000000000e+00
1160558400: nan 1.3333333333e-02
1160558700: nan 0.0000000000e+00
1160559000: nan 1.9800000000e+00
1160559300: nan 2.0000000000e+00
1160559600: nan 1.0066666667e+00
1160559900: nan 1.0000000000e+00
1160560200: nan 2.9933333333e+00
The nan seems to be for the first value, and the number is for the 2nd value.

I then ran:

Code: Select all

rrdtool info <rrd file>
and checked the ds[].min and .max and for both data sources they were set to 0 and 100 respectively:

Code: Select all

ds[speed_km].min = 0.0000000000e+00
ds[speed_km].max = 2.0000000000e+02
ds[speed_knots].min = 0.0000000000e+00
ds[speed_knots].max = 2.0000000000e+02
So this is where I am stuck, everything checks out, but for some reason the first value is not being put into the RRD file.

Is there any other hints on where I might be going wrong?

Thanks.

-Hurgh-
hurgh
Posts: 13
Joined: Wed Oct 11, 2006 2:40 am
Contact:

Post by hurgh »

Well thanks for the help lvm,

I just decided to start from scratch and re-do everything that had to do with the script, and it is now working fine....

Not sure what I did different, but I didnt change the script. maybe it was some box i didnt tick the first time or something.

Again, thanks for your help.

-Hurgh-
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests