[rrd-users] ERROR: illegal attempt to update

David Eisner deisner at gmail.com
Thu Jan 13 17:24:56 CET 2011


In an effort to grok rrdtool I've written a little python script [1]
that calls rrdtool update to generate some synthetic data.

However, when I run the script, I sometimes see errors like this:

$ ./rra_test.py
rm test_rra.rrd
rrdtool create test_rra.rrd --start 1293857700 DS:tst:GAUGE:600:0:U
RRA:AVERAGE:0.5:5:10
0 rrdtool update test_rra.rrd 1293858000:100
1 rrdtool update test_rra.rrd 1293858300:101
2 rrdtool update test_rra.rrd 1293858600:102
3 rrdtool update test_rra.rrd 1293858900:103
4 rrdtool update test_rra.rrd 1293859200:104
ERROR: test_rra.rrd: illegal attempt to update using time 1293858900
when last update time is 1293859200 (minimum one second step)
5 rrdtool update test_rra.rrd 1293859500:105
6 rrdtool update test_rra.rrd 1293859800:106
7 rrdtool update test_rra.rrd 1293860100:107

It doesn't happen all the time.The sleep statements in the script are
an attempt to mitigate the problem. If I increase the sleep time in
the loop from 10ms to 100ms, I don't see the problem.

Presumably this isn't common during "real" rrdtool use, but I'm
curious to know why it's happening. Is there some kind of race
condition with subsequent calls to rrdupdate interfering with previous
invocations? If so, why?

This is rrdtool 1.4.4 on Centos 5.5, i386.

Thanks.

-David


[1] The script:

#!/usr/bin/env python

import sys
from subprocess import Popen
from time import sleep

fname = 'test_rra.rrd'
start_time = 1293858000
step = 300
npoints = 8
start_val = 100

def run_cmd(cmd):
    print cmd
    Popen(cmd, shell=True)


run_cmd( "rm " + fname )
run_cmd( "rrdtool create " + fname + " --start " + str(start_time-step) +
         " DS:tst:GAUGE:600:0:U RRA:AVERAGE:0.5:5:10" )

sleep(0.1)

t = start_time
v = start_val
for i in range(npoints):
    print i,
    run_cmd("rrdtool update %s %d:%d" % (fname, t, v))
    v += 1
    t += step
    sleep(0.01)

sys.exit(0)


-- 
David Eisner     http://cradle.brokenglass.com



More information about the rrd-users mailing list