[rrd-users] Bug with "MAX" RRA ?

Paul Courbis paul at courbis.fr
Tue Dec 30 14:58:48 MET 2003


Hi

I'm trying to setup an RRD database to kkep a track f "MAX" values of a 
counter. My problem is that the values are transformed depending on the 
timeslot alignement. That is, if I setup a RRD database receiving a data 
every minute, the value is used unchanged if it's store on the beginning 
of the minute, while it is transformed (average with previous value) if 
it's entered some second laters.

here's a little shell script that produces 2 curves, one with data 
stored on the beginning of a minute, the other 30 second laters. As I 
keep "MAX" values, curves should be the same (in my mind at least) but 
it's not the case.... Run this script, it'll create a "demo.gif" graph 
showing the problem.

If anyone can explain...

Paul

#!/bin/sh

FILE1=/tmp/demo1.rrd
FILE2=/tmp/demo2.rrd

NOW=`date +%s`
START=`expr $NOW - 800`

for file in $FILE1 $FILE2
do
    /usr/local/rrdtool/bin/rrdtool create $file -s 60 \
      DS:Value:GAUGE:300:0:U \
      RRA:MAX:0.5:1:120  \
      RRA:MAX:0.5:10:360   \
      RRA:MAX:0.5:60:960  \
      RRA:MAX:0.5:1440:400 \
      -b $START
done

FIRST=`expr $NOW - 630`
DELTA=`expr $FIRST % 60`
START1=`expr $FIRST - $DELTA`
START2=`expr $START1 + 30`

/usr/local/rrdtool/bin/rrdtool update $FILE1 $START1:U
/usr/local/rrdtool/bin/rrdtool update $FILE2 $START2:U

START1=`expr $START1 + 60`
START2=`expr $START2 + 60`

VALUE=1
N=1
while [ $N -le 11 ]
do
  /usr/local/rrdtool/bin/rrdtool update $FILE1 $START1:$VALUE
  /usr/local/rrdtool/bin/rrdtool update $FILE2 $START2:$VALUE

  START1=`expr $START1 + 60`
  START2=`expr $START2 + 60`

  if [ "$N" -le 5 ]; then VALUE=`expr $VALUE + 1`; else VALUE=`expr 
$VALUE - 1`; fi

  N=`expr $N + 1`
done

/usr/local/rrdtool/bin/rrdtool graph demo.gif -s $START \
    --title "Demo" \
    DEF:Value1=$FILE1:Value:MAX -v Value1 \
    LINE2:Value1#a00000:'Value1' \
    GPRINT:Value1:LAST:'Last\: %2.1lf -\g' \
        GPRINT:Value1:MIN:' Min\: %2.1lf -\g' \
        GPRINT:Value1:MAX:' Max\: %2.1lf -\g' \
        GPRINT:Value1:AVERAGE:' Average\: %2.1lf\n' \
    DEF:Value2=$FILE2:Value:MAX -v Value2 \
    LINE2:Value2#00a000:'Value2' \
    GPRINT:Value2:LAST:'Last\: %2.1lf -\g' \
        GPRINT:Value2:MIN:' Min\: %2.1lf -\g' \
        GPRINT:Value2:MAX:' Max\: %2.1lf -\g' \
        GPRINT:Value2:AVERAGE:' Average\: %2.1lf\n' \
     -l 0


rm -f $FILE1 $FILE2



--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list