[rrd-users] Fetching from the beginning of an RRD file

Travis Spencer travislspencer at gmail.com
Thu Mar 1 02:05:30 CET 2007


Hey All,

I am trying to fetch all data from the begging of an RRD file.  I'm
not sure when the first entry was added to it, however, so I thought I
could just set the start time to zero.  For example, something like
this:

rrdtool fetch foo.rrd AVERAGE -s 0

That doesn't seem to work though.  At first, I thought it was because
I was using an old version of rrdtool (1.0.49).  I got a newer version
(1.2.10), but the unexpected behavior remained.  Then, I discovered
that if I set the start time to something more recent than epoch, I
got non-NaN values.

To test things more systematically, I wrote a little script:

    #!/bin/sh

    R1=rrdtool
    R2=~/bin/rrdtool
    RRD_FILE=/tmp/test.rrd
    START_TIME=1167724800

    test_start_time()
    {
        R=$R1

        if [[ "$1" == "new" ]]; then
            R=$R2
        fi

        $R fetch $RRD_FILE AVERAGE -s $2 2>&1 | \
            tail -n +3 | fgrep -v "#IND" | wc -l
    }

    echo "\tZero Start Time\t\tNon-Zero Start Time"

    RESULT1=$(test_start_time old 0)
    RESULT2=$(test_start_time old $START_TIME)
    echo "Old RRD\t$RESULT1\t\t\t$RESULT2"

    RESULT1=$(test_start_time new 0)
    RESULT2=$(test_start_time new $START_TIME)
    echo "New RRD\t$RESULT1\t\t\t$RESULT2"

Here is some sample output from that script:

                    Zero Start Time     Non-Zero Start Time
Old RRD       0                          20
New RRD      0                          20

I don't understand this.  Can RRD only cope with start times that are
more recent than some particular date?  Can someone shed some light on
this for me?

TIA!

-- 

Regards,

Travis Spencer



More information about the rrd-users mailing list