[rrd-users] Why do I see NaN values?

Alex van den Bogaerdt alex at ergens.op.het.net
Wed May 21 12:04:36 CEST 2008


On Wed, May 21, 2008 at 09:35:34AM +0000, Leon Stringer wrote:
> Hi,
> 
> I've created an RRD database to store a value (server clock offset in
> ms). I've created a cron job to add the value every 6 hours. As far
> as I can tell the job is running correctly and getting a valid value.
> However, when I run rrd fetch I get a lot of NaN values (between a
> quarter and a third of values) so the generated graphs have gaps too.
> 
> I created the file with:
> 
>   rrdtool create file.rrd -s 21600 DS:offset:GAUGE:21600:U:U
>       RRA:MAX:0:1:360
>       
> I add the data with:
> 
>   rrdtool update file.rrd N:<val>	(E.g. 1.903, -0.424, etc.)
> 
> And I query data with:
> 
>   rrdtool fetch -s -1week file.rrd MAX
> 
> Can anyone tell me why I see NaN values instead of the values I
> (think!) am putting in?

Short answer: because you are using timestamp "N" and heartbeat 21600.

Longer answer:

When you run your script, it is not exactly 00:00, 06:00, 12:00, 18:00.
Sometimes the interval between two updates is a bit longer than 21600
seconds, other times it is a bit shorter.

When the interval is a bit shorter, RRDtool will accept the resulting
rate, when the interval is a bit longer, you(!) ask RRDtool to skip
that rate.

Choose:

1: use fixed timestamps
2: allow for some slack (increase your heartbeat)

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the rrd-users mailing list