[mrtg] temperature graphs averaging out wrong

Alex van den Bogaerdt alex at ergens.op.het.net
Fri Apr 4 03:05:05 CEST 2008


On Fri, Apr 04, 2008 at 11:53:15AM +1300, Max wrote:

> I am happy enough with the daily graphs, but I must be recording the 
> data wrong somewhere, as the graphs for longer periods are not showing 
> the Max or Min of the temperatures, but I suspect are averaging them out 
> over a longer period (i think).
> 
> This is naturally one of those problems of the dam computer doing what I 
> ask it to do, rather than what I want it to do.

Indeed.  You ask it to show averages.

> I'm hoping it is a simple mistake, and somebody can show me the errors 
> of my way, though I suspect I will have to lose all the data I have 
> collected so far :(

That depends.  If you remember correctly, you do store MIN and MAX
rates.  If so, you can start using them and nothing's lost.

> rrdtool graph /var/www/rrdtool/temperature-day.png \
> DEF:in1=/var/www/rrdtool/temperature.rrd:internal:AVERAGE \
> DEF:in2=/var/www/rrdtool/temperature.rrd:inside:AVERAGE \
> DEF:out=/var/www/rrdtool/temperature.rrd:outside:AVERAGE \

> VDEF:MaxIn1=in1,MAXIMUM \

This is the maximum of all averages. You want the maximum of
all maximums.

> VDEF:MinIn1=in1,MINIMUM \

This is the minimum of all averages. You want the minimum of
all minimums.

Suggestion: a couple more DEFs:

> DEF:in1min=/var/www/rrdtool/temperature.rrd:internal:MIN \
> DEF:in2min=/var/www/rrdtool/temperature.rrd:inside:MIN \
> DEF:outmin=/var/www/rrdtool/temperature.rrd:outside:MIN \
> DEF:in1avg=/var/www/rrdtool/temperature.rrd:internal:AVERAGE \
> DEF:in2avg=/var/www/rrdtool/temperature.rrd:inside:AVERAGE \
> DEF:outavg=/var/www/rrdtool/temperature.rrd:outside:AVERAGE \
> DEF:in1max=/var/www/rrdtool/temperature.rrd:internal:MAX \
> DEF:in2max=/var/www/rrdtool/temperature.rrd:inside:MAX \
> DEF:outmax=/var/www/rrdtool/temperature.rrd:outside:MAX \

and change the VDEFs:

> VDEF:MaxIn2=in2max,MAXIMUM \
> VDEF:MinIn2=in2min,MINIMUM \
> VDEF:AvgIn2=in2avg,AVERAGE \

and so on.

Why?  Average RRA's work like this:

RRA 1: 10,11,12,10,9,8,11,12,13,12,10,8 -> 10,11,12,10,9,8,11,12,13,12,10,8
RRA 2: (10,11,12), (10,9,8), (11,12,13), (12,10,8) -> 11,9,12,10
RRA 3: ((10,11,12), (10,9,8)) , ((11,12,13), (12,10,8)) -> 10,10

max(10,11,12,10,9,8,11,12,13,12,10,8) == 13
max(11,9,12,10) == 12
max(10,10)==10
min(10,11,12,10,9,8,11,12,13,12,10,8) == 8
min(11,9,12,10) == 9
min(10,10)==10


Now using the MAX rra:

RRA 1: 10,11,12,10,9,8,11,12,13,12,10,8 -> 10,11,12,10,9,8,11,12,13,12,10,8
RRA 2: (10,11,12),(10,9,8),(11,12,13),(12,10,8) -> 12,10,13,12
RRA 3: ((10,11,12),(10,9,8)),((11,12,13),(12,10,8)) -> 12,13

max(10,11,12,10,9,8,11,12,13,12,10,8) == 13
max(12,10,13,12) == 13
max(12,13)==13


Similar for the MIN rra.


HTH
-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the mrtg mailing list