[mrtg] temperature graphs averaging out wrong

Max Max.mrtg at deltal.org
Fri Apr 4 04:20:24 CEST 2008


Alex van den Bogaerdt wrote:
> 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.
>
>   
Ok, I have made the alterations Alex suggested (hopefully I got them 
like you expected, I think I understood what you were getting at), and I 
have updated the list on the web page ( 
http://corporateturtles.com/tmp/200804041104/ )

I won't list all the changes for all the graphs, but I will list the old 
and then the new below for the yearly graph...

#
# Graph for temperature, Dalmore, Dunedin
#  -- YEAR
#
rrdtool graph /var/www/rrdtool/temperature-year.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                                       \
  VDEF:MinIn1=in1,MINIMUM                                       \
  VDEF:AvgIn1=in1,AVERAGE                                       \
  VDEF:CurrentIn1=in1,LAST                                      \
  VDEF:MaxIn2=in2,MAXIMUM                                       \
  VDEF:MinIn2=in2,MINIMUM                                       \
  VDEF:AvgIn2=in2,AVERAGE                                       \
  VDEF:CurrentIn2=in2,LAST                                      \
  VDEF:MaxOut=out,MAXIMUM                                       \
  VDEF:MinOut=out,MINIMUM                                       \
  VDEF:AvgOut=out,AVERAGE                                       \
  VDEF:CurrentOut=out,LAST                                      \
  COMMENT:"\t\t\tMax\t\t\t\t   Min\t\t\t\t\t Average\t\t\t\tCurrent\n"  \
  AREA:in2#00FF00:"Inside"                                      \
  GPRINT:MaxIn2:"%8.2lf deg C"                                  \
  GPRINT:MinIn2:"\t\t%7.2lf deg C"                              \
  GPRINT:AvgIn2:"\t\t\t%8.2lf deg C"                            \
  GPRINT:CurrentIn2:"\t\t%8.2lf deg C\n"                        \
  LINE1:out#FF0000:"Outside"                                    \
  GPRINT:MaxOut:"%7.2lf deg C"                                  \
  GPRINT:MinOut:"\t\t%7.2lf deg C"                              \
  GPRINT:AvgOut:"\t\t\t%8.2lf deg C"                            \
  GPRINT:CurrentOut:"\t\t%8.2lf deg C\n"                        \
  --title "Temperature, Dalmore, Dunedin, New Zealand 9010"     \
  --base 1000 -r -X 0                                           \
  -s -8760h -w 790 -l 0 --lazy





#
# Graph for temperature, Dalmore, Dunedin
#  -- YEAR (mark 2)
#
rrdtool graph /var/www/rrdtool/temperature-year2.png            \
  DEF:in1now=/var/www/rrdtool/temperature.rrd:internal:AVERAGE  \
  DEF:in2now=/var/www/rrdtool/temperature.rrd:inside:AVERAGE    \
  DEF:outnow=/var/www/rrdtool/temperature.rrd:outside:AVERAGE   \
  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 \
  VDEF:MaxIn1=in1max,MAXIMUM                                    \
  VDEF:MinIn1=in1min,MINIMUM                                    \
  VDEF:AvgIn1=in1avg,AVERAGE                                    \
  VDEF:CurrentIn1=in1now,LAST                                   \
  VDEF:MaxIn2=in2max,MAXIMUM                                    \
  VDEF:MinIn2=in2min,MINIMUM                                    \
  VDEF:AvgIn2=in2avg,AVERAGE                                    \
  VDEF:CurrentIn2=in2now,LAST                                   \
  VDEF:MaxOut=outmax,MAXIMUM                                    \
  VDEF:MinOut=outmin,MINIMUM                                    \
  VDEF:AvgOut=outavg,AVERAGE                                    \
  VDEF:CurrentOut=outnow,LAST                                   \
  COMMENT:"\t\t\tMax\t\t\t\t   Min\t\t\t\t\t Average\t\t\t\tCurrent\n"  \
  AREA:in2max#00FF00:"Inside"                                   \
  GPRINT:MaxIn2:"%8.2lf deg C"                                  \
  GPRINT:MinIn2:"\t\t%7.2lf deg C"                              \
  GPRINT:AvgIn2:"\t\t\t%8.2lf deg C"                            \
  GPRINT:CurrentIn2:"\t\t%8.2lf deg C\n"                        \
  LINE1:outmax#FF0000:"Outside"                                 \
  GPRINT:MaxOut:"%7.2lf deg C"                                  \
  GPRINT:MinOut:"\t\t%7.2lf deg C"                              \
  GPRINT:AvgOut:"\t\t\t%8.2lf deg C"                            \
  GPRINT:CurrentOut:"\t\t%8.2lf deg C\n"                        \
  --title "Temperature, Dalmore, Dunedin, New Zealand 9010"     \
  --base 1000 -r -X 0                                           \
  -s -8760h -w 790 -l 0 --lazy




I believe the graphs are correct now. My main giveaway before to the 
fact that something was wrong was that my yearly MIN was a higher number 
than my monthly MIN, and also my yearly MAX was lower than my monthly 
MAX. With the new changes, this is no longer the case :)

Naturally, please let me know if you believe I have made any other mistakes.


Thanks Alex, and the rest of you that make this a fantastic list.


Max
Dunedin, NZ



More information about the mrtg mailing list