[rrd-users] rate per day graph from rate per hour DS

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Jan 30 00:09:27 CET 2007

On Mon, Jan 29, 2007 at 05:34:33PM -0500, Ben Griffith wrote:
> Hi,
> I have a RRD that was defined as follows:
> rrdtool create $sensor.rrd -s 3600 \
>        DS:minutes:ABSOLUTE:3600:0:60 \
>        RRA:MAX:0.5:1:4800
> Once per minute the RRD is updated with a 1 if my boiler is running, or a 0
> if it is not.

An update at 19:01 describes time 19:00 to 19:01.

If your boiler was switched off a fraction of a second before you ran
your rrdtool command, you will update with a wrong status.

This will of course be countered by the opposite: your boiler switched
on a fraction of a second ago and you note "1" where the real status
should have been "0".

Your step size is 3600 seconds.  Each minute you add another portion
of the hourly statistics, I think using an averaging computation.
(not 100% sure, but pretty sure)

> I'm not sure if MAX is appropriate for the RRA in my case or not, but all
> four aggregate functions gave me the same (correct) results for the hourly
> graph.

That's because MIN(x) = MAX(x) = AVG(x) = LAST(x) if there's only one x.

> What I'd like to do now is have a similar pseudo bar graph showing how many
> minutes the boiler was running each day.  I thought the following command
> should do it:
> rrdtool graph /home/griffith/public_html/boiler_day.png \
>              --start -5_day --x-grid DAY:1:DAY:1:DAY:1:86400:%A \
>              --height 200 --width 500 --imgformat PNG \
>              --title "Boiler run-time per day" --vertical-label "minutes" \
> DEF:ib1=/usr/local/misterhouse/trunk/data/rrd/Burner_Counter.rrd:minutes:MAX:step=86400
> \
>              CDEF:minperday=ib1,86400,* \
>              AREA:minperday#ff0000 \
>              COMMENT:"$timenow"
> For some reason this is not making the step boundaries at midnight, but at
> 19:00.

Discussed over and over again.  It _*is*_ at midnight, but not in your timezone.
Times are UTC internally.

>         The consolidation doesn't seem to be giving me the "minutes per
> second" rate that I got without consolidation.  When I multiply by the
> number of seconds in a day I'm getting a daily rate that I think is about
> three times what it should be.

When there are 24 X-es, MIN(x) != MAX(x) != AVG(x) != LAST(x)
(if they happen to be the same, that would really be a coincidence)

> I tried supplying start and end times in the DEF, but the boundaries are
> still always placed at 19:00.  How can I change that?

Find a way to work with 24 hourly values instead of 1 daily value.

Or "cheat", and run your RRDtool with deliberately wrong timezone

TZ="UTC" rrdtool create ...
TZ="UTC" rrdtool update ...
TZ="UTC" rrdtool graph ...

or something similar.

Alex van den Bogaerdt

More information about the rrd-users mailing list