[rrd-users] Can't get rid of NaN in rrd / rra

Chris Herrmann chris.herrmann at faredge.com.au
Fri Aug 11 04:12:23 CEST 2017


Hi all, apologies for the cross post, I originally posted in the Cacti forums https://forums.cacti.net/about15136.html but it's probably more appropriate here.

-------------------

Hi, I've been bashing my head against this issue for a while now... time to get some help.

I'm reading data from a database into variables, and then dropping that into the rrd. Graphs aren't working in cacti, which is failing because the rra aggregations are all returning nan. I've worked my way through a whole bunch of stuff to no avail. So... here's where I'm currently at:

cron runs a script every 5 minutes. This script basically does:
rrdtool updatev /var/www/mrtg/applications/test.rrd N:$rttime >> /var/log/rttime.log 2>&1

(I'm using updatev right now to try and get more information about what's going on).

the RRD is defined:
/usr/bin/rrdtool create \
/var/www/mrtg/applications/test.rrd \
--step 300 \
DS:rttime:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:AVERAGE:0.5:1440:820 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:MAX:0.5:1440:820 \


$rttime is populated by querying a sql server database and returning the floating value to the variable.
I'm using mssql 0.6.2 from https://www.npmjs.com/package/sql-cli to talk to the sql server.

So the command string ends up looking like

$SQLBIN -s "$DBHOST" -d "$DBNAME" -u "$DBUSER" -p "$DBPASSWD" -q "$QUERY1" -f csv | sed 's/"//g' | cut -d , -f 1,3 > /tmp/output.txt

which gets me useful fields. Populating the variable happens with:

rttime=`sed -n "$i p" /tmp/output.txt | cut -d , -f 2`

which will give something like:
2.0166666666666666

If I then update the rrd:
rrdtool updatev /var/www/mrtg/applications/test.rrd N:$rttime >> /var/log/rttime.log 2>&1

rrdtool updatev /var/www/mrtg/applications/test.rrd N:0
return_value = 0
[1502287200]RRA[AVERAGE][1]DS[rttime] = NaN
...

It puts the data into the rrd, but the rras don't get populated:
filename = "/var/www/mrtg/applications/test.time.rrd"
rrd_version = "0003"
step = 300
last_update = 1502250603
header_size = 4120
ds[rttime].index = 0
ds[rttime]= "GAUGE"
ds[rttime].minimal_heartbeat = 600
ds[rttime].min = 0.0000000000e+00
ds[rttime].max = 1.0000000000e+03
ds[rttime].last_ds = "1.4166666666666667
ds[rttime].value = NaN
ds[rttime].unknown_sec = 3
rra[0].cf = "AVERAGE"
rra[0].rows = 500
rra[0].cur_row = 301
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
...

valid data in this case is likely to range from 0 - 10, and will be floating point. But the doco says GAUGE should be OK with float?

Now... I have some rrds & accompanying graphs using almost exactly the same process, but where the data returned is always an integer - and they work fine. Maybe this is the problem? I've just modified the script to only return 2dp (in case it was a problem with too many decimal places...)

Nope... still getting NaN for all the averages.

Where do I look next?

Thanks!

--
Regards

Chris Herrmann
Far Edge Technology

p. 02 84251400
m. 0403 393309
http://www.faredge.com.au

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.oetiker.ch/pipermail/rrd-users/attachments/20170811/99e6390a/attachment.html>


More information about the rrd-users mailing list