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

Simon Hobson linux at thehobsons.co.uk
Tue Jan 30 09:06:01 CET 2007


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.

>  > 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.
>
>
>This is the method I chose.  Here's what I came up with:
>
>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"


I think something similar came up a while ago on this list, and the 
suggestion was something like

if time of day <=19:00
   then do one calculation
   else do a slightly different calculation

I can't remember any more detail about it.



More information about the rrd-users mailing list