[rrd-users] RRD::update failing on first update every time?

A Darren Dunham ddunham at taos.com
Mon Aug 16 21:10:50 CEST 2010


> On Tue, Aug 10, 2010 at 12:11:55PM -0700, Jo Rhett wrote: Interesting
> is that running it quickly again and again never hits it.  But walk
> away and run it 20 minutes later and you'll see the problem every
> time.  There is some real funkiness in the timestamp detection here.

After adding a little more debugging data, I get this information:

-bash-3.00$ ./sample 
getLatestRRDTimestamp( test.rrd ) found timestamp 1281985200
Latest value is 1281985200
Insert into test.rrd values 1281985361, 1538382433, 1068321134
last_update = 1281985358
step = 300
last_update = 1281985361
step = 300

-bash-3.00$ ./sample 
getLatestRRDTimestamp( test.rrd ) found timestamp 1281985200
Latest value is 1281985200
Insert into test.rrd values 1281985361, 1538382433, 1068321134
last_update = 1281985361
step = 300
ERROR while updating test.rrd: illegal attempt to update using time
1281985361 when last update time is 1281985361 (minimum one second step)
last_update = 1281985361
step = 300

Here we see that on one run, the update timestamp is 1281985361.  But
you have calculated a "Latest value" as 1281985200.  I haven't gone
through your calculations yet, but it seems that is where the error is.
When the RRD is polled directly, it (correctly as far as I can see) says
that the last update was 1281985361.

So my question becomes, what is going on here?

        # Now find the latest timestamp
        my $found = 0;
        while( $timestamp >= $start ) {
                if( $values{ $timestamp }->[1] ) {
                        $found = $timestamp;
                        last;
                }
                elsif( $values{ $timestamp }->[2] ) {
                        $found = $timestamp;
                        last;
                }
                else {
                        $timestamp -= $step;
                        next;
                }
        }

And why are you not just using the simpler one-liner below?

        my $found = RRDs::latest ($filename );

-- 
Darren



More information about the rrd-users mailing list