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

Ben Griffith griffithba at gmail.com
Tue Jan 30 23:07:55 CET 2007

```On 1/30/07, Simon Hobson <linux at thehobsons.co.uk> wrote:
>
> Ben Griffith wrote:
>
> >Doesn't it just add up all the entries to get a total for the hour,
> >then from that a rate per second?  Or does it actually compute the
> >rate throughout the hour, on the fly?
>
> No, it ALWAYS computes an average/max/min depending on what you set
> in the rrd. Also, you NEED to use average or your figures are
> guaranteed to be wrong. For example, suppose we just look at 4
> samples :
>
> 1  1  0  0
>
> Clearly your boiler was running for half the time (give or take a bit
> due to the sampling), and average would give you 0.5. Max would give
> you 1 for any period where the boiler ran at all which is not what
> you want.

The 1 1 0 0 are counter values, so they are added together and then divided
by the step interval.  In this case, if the interval was 4 minutes (240
seconds) that would mean 2/240.  Since I've set up the RRA to contain only
one step (size 1 hour), it's like Alex said: "MIN(x) = MAX(x) = AVG(x) =
LAST(x) if there's only one x."  If I had said the step size was 15 minutes
and the RRA contained 4 of them then I'd be in trouble.  I didn't know how
all of that worked when I set it up, so I guess I just lucked out.  I think
I've got it now though.  I agree that even though MAX works just fine in
this case it is misleading.

>
> >filename=/usr/local/misterhouse/trunk/data/rrd/Burner_Counter.rrd
> >timenow=`date | sed 's/:/\\\:/g'`
> >rrdtool graph /home/griffith/public_html/boiler_day.png \
> >               --end 00\:00 --start end-7d --x-grid
> >DAY:7:DAY:7:DAY:1:86400:%A \
> >               --height 200 --width 500 --imgformat PNG \
> >               --title "Boiler run-time per day" --vertical-label
> "minutes" \
> >               DEF:day1=\$filename:minutes:MAX:start="midnight
> >yesterday - 6d":end=start+23h \
>
> Two things wrong here (I think) :
>
> First, you don't want max, you want average (see above)
>
> Second, I think you need "start+24h" not "start+23h"

That's what I thought too, but "start+24h" and "start+1d" both gave me 25
hours of data instead of 24, and my "bars" overlapped from midnight to 1am.
The totals are correct when I use +23h.  I guess by saying start is
"midnight yesterday" I get that first hour, and then I want 23 more hours,
not 24.

That doesn't seem right.  Did I find a bug?  I'm using 1.2.15-r3 from Gentoo
portage.

-Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20070130/1c5e45b4/attachment-0001.html
```