[rrd-users] Decimals in result, but not in data

Tero Salminen tero.salminen at vaasaweather.com
Tue Feb 21 06:53:27 MET 2006

Hi there

I'm little baffled here. I'm measuring light value to sql-database,
and the value is between 0 and 65535 with no decimals.

All works, but how am I getting values like 0.2 as LAST?
(check the GPRINT in rrdgraph below) What there should be
is 1, 2 or 123 or something, not 0.2 ?

What am I missing? Something with this line perhaps:
DEF:light=$install/rrddb/w_light.rrd:light:AVERAGE \

This replicates itself to week, month and year graphs also,
they are done with "-s -1week" and so on.

Data in sql is in format "0.00" "1.00" and so on, collected with

light=`mysql -u "$db_user" -p"$db_pass" "$db_name" -N -e \
"SELECT Value FROM "$db_table" WHERE \
channel = '8' ORDER BY samplekey DESC LIMIT 1;" | awk '{print $1}'`

and inserted to rrd with:

rrdtool update $install/rrddb/w_light.rrd N:$light

rrd create is as follows:

rrdtool create w_light.rrd DS:light:GAUGE:600:0:65535 \
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:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \

And for the last, here's the graph:

# Do the graphics for light
rrdtool graph $wwwpath/w_light_day.png \
 -n DEFAULT:0:$font \
 -t "Relative light amount in last day, $w_loc units" \
 -h 279 -w 575 \
 -X 2 \
 -i \
 -E \
 DEF:light=$install/rrddb/w_light.rrd:light:AVERAGE \
 LINE2:light#3333CC:"$sens_1 light\t" \
 GPRINT:light:MAX:"Max\: %6.1lf units\t" \
 GPRINT:light:MIN:"Min\: %6.1lf units\t" \
 GPRINT:light:AVERAGE:"Average\: %6.1lf units\t" \
 GPRINT:light:LAST:"Current\: %6.1lf units\\c" \
 COMMENT:""\\c \
 COMMENT:"$w_copy\c" \

Thanks in advance for Your input!

Tero Salminen
www.vaasaweather.com <http://www.vaasaweather.com>

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

More information about the rrd-users mailing list