NaN mixed with normal values

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

Moderators: Developers, Moderators

Post Reply
Wirthmueller
Cacti User
Posts: 60
Joined: Wed Mar 02, 2011 9:02 am

NaN mixed with normal values

Post by Wirthmueller »

I got a very particular problem that from the same input some values are graphed and others give me a NaN.

I am using the following perl script as a data input method.

Code: Select all

perl /usr/share/cacti/site/scripts/fhem-getstate.pl -s 'localhost' -d 'Libelium_1'
This gives me the following output:
01_frame_number:2 01_frame_type:128 01_id:1 01_id_secret:403470039 01_parser_type:1 01_sync:0 01_value:7.16 02_frame_number:2 02_frame_type:128 02_id:2 02_id_secret:403470039 02_parser_type:1 02_sync:0 02_value:66.7 03_frame_number:2 03_frame_type:128 03_id:3 03_id_secret:403470039 03_parser_type:1 03_sync:0 03_value:12.20 04_frame_number:2 04_frame_type:128 04_id:4 04_id_secret:403470039 04_parser_type:1 04_sync:0 04_value:10.30 05_frame_number:2 05_frame_type:128 05_id:5 05_id_secret:403470039 05_parser_type:1 05_sync:0 05_value:8.31 06_frame_number:2 06_frame_type:128 06_id:6 06_id_secret:403470039 06_parser_type:1 06_sync:0 06_value:3436.43 07_frame_number:2 07_frame_type:128 07_id:7 07_id_secret:403470039 07_parser_type:1 07_sync:0 07_value:0.000
Now from this I would want to graph the following numbers using the Gauge setting in the graph template (this is the one which is supposed to tolerate floats):
02_value:66.7
06_value:3436.43
07_value:0.000

Strange enough only 02_value gives me a curve and numbers. Both 06_value and 07_value appear as NaN in both the graph and in the rrd-file.

This is the RRDTool command:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start='-86400' \
--end='-300' \
--pango-markup  \
--title='FHEM Libelium Humidity' \
--vertical-label='Relative Humidity (%)' \
--slope-mode \
--base=1000 \
--height=200 \
--width=700 \
--alt-autoscale \
COMMENT:"From 2020/03/12 16\:28\:42 To 2020/03/13 16\:23\:42\c" \
COMMENT:"  \n" \
--color BACK#F3F3F3 \
--color CANVAS#FDFDFD \
--color SHADEA#CBCBCB \
--color SHADEB#999999 \
--color FONT#000000 \
--color AXIS#2C4D43 \
--color ARROW#2C4D43 \
--color FRAME#2C4D43 \
--border 1 --font TITLE:11:'Arial' \
--font AXIS:8:'Arial' \
--font LEGEND:8:'Courier' \
--font UNIT:8:'Arial' \
--font WATERMARK:6:'Arial' \
--slope-mode \
--watermark 'Generated by Cacti®' \
DEF:a='/usr/share/cacti/site/rra/local_linux_machine_lw_60.rrd':'HUMB':AVERAGE \
DEF:b='/usr/share/cacti/site/rra/local_linux_machine_lw_60.rrd':'SOIL':AVERAGE \
DEF:c='/usr/share/cacti/site/rra/local_linux_machine_lw_60.rrd':'LW':AVERAGE \
CDEF:cdefh='b,550,-,137.5,/' \
COMMENT:'\t\t\tMinimum\t\t\tCurrent\t\t\tAverage\t\t\tMaximum\n'  \
COMMENT:'                        -------------------------------------------------------------------------------\n'  \
LINE1:a#0000FFFF:'Luft\: '  \
GPRINT:a:LAST:'\t%8.2lf%s '  \
GPRINT:a:MIN:'\t%12.2lf'  \
GPRINT:a:AVERAGE:'\t%12.2lf'  \
GPRINT:a:MAX:'\t%12.2lf\n'  \
LINE1:cdefh#A0CFECFF:'Erde\: '  \
GPRINT:cdefh:LAST:'\t%8.2lf%s '  \
GPRINT:cdefh:MIN:'\t%12.2lf'  \
GPRINT:cdefh:AVERAGE:'\t%12.2lf'  \
GPRINT:cdefh:MAX:'\t%12.2lf\n'  \
LINE1:c#3090C7FF:'Blatt\:'  \
GPRINT:c:LAST:' \t%8.2lf%s '  \
GPRINT:c:MIN:' \t%12.2lf'  \
GPRINT:c:AVERAGE:' \t%12.2lf'  \
GPRINT:c:MAX:' \t%12.2lf\n' 

RRDtool Says:

OK
Any help to this?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: NaN mixed with normal values

Post by cigamit »

Its most likely just being cut off so Cacti doesn't see it. The text is greater than 512 characters, so you may have to increase the "output" field length on the "poller_output" table. You didn't specify your Cacti version either, so can't say whether other things are also coming into play.
User avatar
camerabob
Cacti User
Posts: 386
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: NaN mixed with normal values

Post by camerabob »

AN FYI: 512 ends somewhere in the middle of "05_parser_type:1". If other values are less used, you could possibly change the order of the PERL output to place what you need at the beginning of the line. Not sure how the output is crafted.
Prod: Cacti 1.2.15 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Temp: Cacti 1.2.3 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Router Configs @ 1.3.4
Syslog Monitoring @ 2.1
Thold @ 1.2.4
Wirthmueller
Cacti User
Posts: 60
Joined: Wed Mar 02, 2011 9:02 am

Re: NaN mixed with normal values

Post by Wirthmueller »

Thank you @cigamit and @camerabob you were perfectly right. Changing my script gave me the followoing output:
L_HUMB:75.6 L_LW:0.000 L_SOIL:1377.41 L_SOILT:9.65 L_TCB:7.26 L_TCC:4.94 L_UV:15.79
Shortening my output solved the problem.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests