[rrd-users] Last value always nan

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Sep 4 17:21:52 CEST 2007

On Tue, Sep 04, 2007 at 04:45:59PM +0200, Michael Jürgens wrote:
> Hi,
> I´m using mrtg to collect data and rrdtool to create graphs.
> I´m now trying to fetch the last value from datasource and always get NaN.

You are trying to fetch the last rate.

You start by looking at the last update:

>     > /usr/local/rrdtool/bin/rrdtool last
>     /home/mrtg/data/dolly.log4j.warn.rrd
>     > 1188916748

This last update may or may not result in completing one standard
time interval.  See my site, normalization.

>     > /usr/local/rrdtool/bin/rrdtool fetch
>     /home/mrtg/data/dolly.log4j.warn.rrd AVERAGE   -s 1188916748 -e
>     1188916748

Here you ask for information upto and including 1188916748.
Apparently the normalized interval which contains timestamp
1188916748 ends at 1188916860.  This is a multiple of 60, do
you have a one-minute interval in your database ?

Let's assume you do.

The interval 1188916860-60 upto 1188916860 is not yet known. Part
of it is in the future.

However, the user is always right so if the user wants to query
data in the future, he will get whatever little is known. In this
case, that's 'nan'.

>     >                             ds0                 ds1
>     >
>     > 1188916860: nan nan


Integer divide 1188916748 by your step size (60?), then multiply
by the same amount.  The result is 1188916740. Use that as end time.

Alex van den Bogaerdt

More information about the rrd-users mailing list