[rrd-users] Simple questions about RRD

Jean-Yves Avenard jyavenard at gmail.com
Mon Dec 7 09:34:06 CET 2009


Hi..

Sorry, I'm bumping that one ; as even after investigating for quite a
few days ; I can't figure out how the maximum is calculated in the
graph...

2009/12/6 Jean-Yves Avenard <jyavenard at gmail.com>:

> Looking at:
> http://htpc.avenard.org/power/screen.png
>
> It shows the maximum as being 2972W ; which is indeed the maximum with
> the actual data at the highest resolution.
> But it's definitely not the maximum of 5 minutes average as the graph
> shows: nothing is over 2200W
>

I've re-created the RRD with:
100 day of 1 minute average,min,max
5 years of 5 minutes average,min,max
5 years of 30 minutes average,min,max
5 years of 2 hours average,min,max
5 years of daily average,min,max

rrdtool create currentcost3.rrd -s 60 \
DS:total:GAUGE:300:0:U \
DS:ch1:GAUGE:300:0:U \
DS:ch2:GAUGE:300:0:U \
DS:ch3:GAUGE:300:0:U \
RRA:AVERAGE:0.5:1:144000 \
RRA:AVERAGE:0.5:5:525600 \
RRA:AVERAGE:0.5:30:87840 \
RRA:AVERAGE:0.5:120:21960 \
RRA:AVERAGE:0.5:1440:1830 \
RRA:MIN:0.5:1:144000 \
RRA:MIN:0.5:5:525600 \
RRA:MIN:0.5:30:87840 \
RRA:MIN:0.5:120:21960 \
RRA:MIN:0.5:1440:1830 \
RRA:MAX:0.5:1:144000 \
RRA:MAX:0.5:5:525600 \
RRA:MAX:0.5:30:87840 \
RRA:MAX:0.5:120:21960 \
RRA:MAX:0.5:1440:1830


> That graph is created with :
>
> $ret = exec("$RRDTOOL graph $name -l 0 \
> -t '$title' \
> -x $legend \
> --step $res --start e-$start --end $timestamp \
> -w $width -h $height \
> DEF:total=currentcost.rrd:total:AVERAGE DEF:ch2=currentcost.rrd:ch2:AVERAGE \
> DEF:solar=solarprod.rrd:total:AVERAGE DEF:ch1=currentcost.rrd:ch1:AVERAGE \
> DEF:totalmin=currentcost.rrd:total:MIN:reduce=AVERAGE
> DEF:ch2min=currentcost.rrd:ch2:MIN:reduce=AVERAGE \
> DEF:solarmin=solarprod.rrd:total:MIN:reduce=AVERAGE
> DEF:ch1min=currentcost.rrd:ch1:MIN:reduce=AVERAGE \
> DEF:totalmax=currentcost.rrd:total:MAX:reduce=AVERAGE
> DEF:ch2max=currentcost.rrd:ch2:MAX:reduce=AVERAGE \
> DEF:solarmax=solarprod.rrd:total:MAX:reduce=AVERAGE
> DEF:ch1max=currentcost.rrd:ch1:MAX:reduce=AVERAGE \
>    VDEF:ds0max=ch2max,MAXIMUM \
>    VDEF:ds0avg=ch2,AVERAGE \
>    VDEF:ds0min=ch2min,MINIMUM \
>    VDEF:ds0pct=ch2,95,PERCENT \
>    VDEF:ds1max=totalmax,MAXIMUM \
>    VDEF:ds1avg=total,AVERAGE \
>    VDEF:ds1min=totalmin,MINIMUM \
>    VDEF:ds1pct=total,95,PERCENT \
>    VDEF:ds2max=ch1max,MAXIMUM \
>    VDEF:ds2avg=ch1,AVERAGE \
>    VDEF:ds2min=ch1min,MINIMUM \
>    VDEF:ds2pct=ch1,95,PERCENT \
>    VDEF:ds3max=solarmax,MAXIMUM \
>    VDEF:ds3avg=solar,AVERAGE \
>    VDEF:ds3min=solarmin,MINIMUM \
>    VDEF:ds3pct=solar,95,PERCENT \
>  COMMENT:'           ' \
>  COMMENT:'Maximum ' \
>    COMMENT:'Average ' \
>    COMMENT:'Minimum '  \
>    COMMENT:'95th percentile\l' \
>    LINE1:total#000090:'Total   ' \
>    GPRINT:ds1max:'%5.0lf W ' \
>    GPRINT:ds1avg:'%5.0lf W ' \
>    GPRINT:ds1min:'%5.0lf W ' \
>    GPRINT:ds1pct:' %5.0lf W\l' \
>    LINE1:ch1#00FF00:'Pool    ' \
>    GPRINT:ds2max:'%5.0lf W ' \
>    GPRINT:ds2avg:'%5.0lf W ' \
>    GPRINT:ds2min:'%5.0lf W ' \
>    GPRINT:ds2pct:' %5.0lf W\l' \
>    LINE1:solar#FF0000:'Solar   ' \
>    GPRINT:ds3max:'%5.0lf W ' \
>    GPRINT:ds3avg:'%5.0lf W ' \
>    GPRINT:ds3min:'%5.0lf W ' \
>    GPRINT:ds3pct:' %5.0lf W\l'
>
> where $res , the argument for --step is 300 (5 minutes) and I do use
> the reduce=AVERAGE option.
>

timestamp is on a multiple of 300 (created in php with:  $timestamp =
(floor(mktime() / $res) * $res)

MAX on the graph still shows up at 2972W ; the graph itself shows the
max to be around 2200W.
When I use rrdtool fetch ; and check the maximum ; the value is indeed 2170W...

So why does graph reports the maximum not of the resolution wanted ;
but of the highest level resolution ? (the one that is 1 min average)

I've tried with:
> DEF:totalmax=currentcost.rrd:total:MAX:reduce=AVERAGE
and
> DEF:totalmax=currentcost.rrd:total:MAX:step=300:reduce=AVERAGE
defining --step or not ; always getting the incorred 2972W.

Any help would be appreciated..

Thanks
Jean-Yves



More information about the rrd-users mailing list