[rrd-users] timestamp and manually inserting data

Ron Peterson rpeterso at mtholyoke.edu
Wed Jan 23 17:38:52 CET 2008


Hi,

I'm trying to manually insert data into an rrd database from a file.  I
have a set of GAUGE values that have been collected every second.  The
actual time these values were collected isn't important.  I just want to
feed them into rrdtool at one second intervals.

I created my database like so:

rrdtool create $RRDFILE \
    --start 1 \
    --step 1 \
    DS:MBs_read:GAUGE:2:0:500 \
    DS:MBs_write:GAUGE:2:0:500 \
    RRA:AVERAGE:0:5:43200 \
    RRA:MIN:0:5:43200 \
    RRA:MAX:0:5:43200 \
    RRA:AVERAGE:0:60:720 \
    RRA:MIN:0:60:720 \
    RRA:MAX:0:60:720

I'm trying to feed my rrdfile like so:

function getdata() {
    cat log.iostat | grep ^${DEV} | tr -s ' ' ' ' | cut -d' ' -f 3,4
}

# We don't really care when our time stamps begin, only that they
# increment at one second intervals.
i=1
while read blocksread blockswritten
do
  i=$((i + 1))
  mbsread=$(echo "scale=0; $blocksread * 512 / 1000000" | bc)
  mbswritten=$(echo "scale=0; $blockswritten * 512 / 1000000" | bc)
  rrdtool update $RRDFILE $i:$mbsread:$mbswritten
done<<EOF
$(getdata)
EOF

This doesn't work, however.  I get an error like:

...illegal attempt to update using time 2 when last update time is 1201069000

I thought the --start parameter to the creation command set the initial
timestamp, so I obviously don't understand something here.

??

(Yes, this might be a clumsy way to make a graph, but I thought it would
be a good excuse to learn rrdtool..)

-- 
Ron Peterson
Network & Systems Manager
Mount Holyoke College



More information about the rrd-users mailing list