[rrd-users] problem understanding update
Alex van den Bogaerdt
alex at ergens.op.het.net
Thu Nov 29 18:17:19 CET 2007
On Thu, Nov 29, 2007 at 05:20:53PM +0100, marie wrote:
> Hi all,
>
> I have trouble understanding the update function behaviour, mainly with
> the 'N' feature.
>
> Assume you have created the following rrd database:
>
> --
> rrdtool create test_mechanism.rrd --start `date +%s` --step 1 \
> DS:number:GAUGE:2:U:U RRA:LAST:0.5:1:20 ;
> --
>
> I try to update this small rrd by adding values (from 10 to 90 ) every
> second during 10 seconds with the following little bash script (which is
> not a very clean one!):
>
> --
> #!/bin/sh
>
> i=1
> while [ $i -lt 11 ]
> do
> current=`date +%s`
> value=`expr $i \* 10`
> # echo $value at $current
> rrdtool update test_mechanism.rrd N:$value
> i=`expr $i \+ 1`
> perl -e 'sleep 1 - time % 1'
> done
This is where you go wrong. You assume "N" equals 1196351129
but in reality it is more like 1196351129.312388
You sleep for less than one second, then assume "current=`date +%s`" is
happening at exactly a whole second, and you also assume computing
the value to update takes no time, and executing rrdtool does take no
time.
> Why is there such a difference in the values inserted by the two update
> ways ? (2.0000000000e+01 vs 6.8761200000e+00, for example)
> What am I misunderstanding ?
Look at my site, the part talking about normalizing
HTH
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list