Reinhard Scheck | 2 Mar 2009 20:58
Picon

Re: NaN results from valid script

Cal Heldenbrand wrote:
> Hello,
> 
> I tried searching for this issue, but couldn't find a place to search the
> mailing list on sourceforge.  Sorry if this is a duplicate.
> 
> I just upgraded to from 0.8.7a to 0.8.7d and created a script to pull disk
> I/O stats, which outputs a format like "read:1234 write:5678"  I've checked
> through the Cacti logs, the script is called successfully and has the
> correct output.  (I've checked all of the other normal things like
> permissions, etc)
> 
> Here's what the log looks like:
> 
> 02/27/2009 10:45:02 AM - SPINE: Poller[0] Host[111] DS[1703] SCRIPT:
> /usr/bin/perl /var/www/html/cacti-0.8.7d/scripts/diskio26.pl web20 sda,
> output: read:4177 write:209605
> 
> Pulling data from the RRD file shows that the value wasn't added with
> RRDtool correctly.  (I also didnt' set a min/max value, and also tried
> setting a max value to something very large with the same results)
> 
> <!-- 2009-02-26 18:00:00 CST / 1235692800 --> <row><v> 4.3060400000e+03
> </v><v> NaN </v></row>
> 
> In this case, the disk reads were graphing correctly, but the writes were
> NaN values.  After screwing around a bunch (removed & added all of the Data
> Input and templates) I tried adding a place holder field at the end of the
> script, zztest: 2
> 
> 02/27/2009 11:05:03 AM - SPINE: Poller[0] Host[111] DS[1716] SCRIPT:
> /usr/bin/perl /var/www/html/cacti-0.8.7d/scripts/diskio26.pl web20 sda,
> output: read:983 write:217940 zztest:1
> 
> But after that, the NaN field swapped.  Writes were showing valid values,
> but reads were NaN.
> 
> ------------------------------------------------------------------------------------------
> rrdtool fetch 1716.rrd AVERAGE
> 
> 1235754300: nan nan
> 1235754600: nan 2.1910521406e+05
> 1235754900: nan 2.1801617000e+05
> 1235755200: nan 2.1800202000e+05
> 1235755500: nan 4.5918134667e+05
> 1235755800: nan 2.1675886000e+05
> 1235756100: nan 2.1402336667e+05
> 1235756400: nan 2.1065158000e+05
> 1235756700: nan 2.0651958000e+05
> 1235757000: nan 2.2000055000e+05
> ------------------------------------------------------------------------------------------
> Also double checking the mysql stuff, it appears fine:
> 
> AM - SPINE: Poller[0] DEVDBG: SQL:'INSERT INTO poller_output (local_data_id,
> rrd_name, time, output) VALUES (1716,'','2009-02-27 11:51:20','read:630
> write:242136 zztest:1')
> 
> ( removed the extra junk from that line)
> 
> Taking this one step further, I added an aatest at the beginning of the
> fields, and now the graph works fine
> 
> ------------------------------------------------------------------------------------------
> 02/27/2009 12:15:36 PM - SPINE: Poller[0] Host[111] DS[1716] SCRIPT:
> /usr/bin/perl /var/www/html/cacti-0.8.7d/scripts/diskio26.pl web20 sda,
> output: aatest:1 read:361 write:274070 zztest:2
> 
> 1235763000: 9.3813333333e+02 2.0923755333e+05 1.0000000000e+00
> 2.0000000000e+00
> 1235763300: 5.7694133333e+03 2.0998299333e+05 1.0000000000e+00
> 2.0000000000e+00
> 1235763600: 1.9637600000e+03 2.0770929333e+05 1.0000000000e+00
> 2.0000000000e+00
> 1235763900: nan nan nan nan
> ------------------------------------------------------------------------------------------
> 
> Does this have anything to do with bug #001097?  (patch to allow NaN
> numbers)

Did you make sure, that the "print" of all three values is done in a single
"print" statement?
Reinhard

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

Gmane