[mrtg] temperature graphs averaging out wrong

Max Max.mrtg at deltal.org
Fri Apr 4 00:53:15 CEST 2008


Why are my temperatures averaging?

I'm not very good with MRTG, RRDTOOL's, and the like but...
I have some graphs which are recording the (internal and external) 
temperature at my house.

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.

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 :(

**I have made a quick webpage with this question as the web page also 
displays the graphs, and has a copy of the data, so people can see what 
my problem is... the link is...

http://corporateturtles.com/tmp/200804041104/



The script I use to collect the data is listed below...


#
# Collect data from LabJack U3 with temp probes
#
let pass=0;
for readline in `/home/maxwelld/.labjack/u3Feedback_h`
do
if [ $pass = "0" ] ; then internal=$(echo "$readline 1 * p" | dc) ;
fi
if [ $pass = "1" ] ; then inside=$(echo "$readline 1 * p" | dc ); fi
if [ $pass = "2" ] ; then outside=$(echo "$readline 1 * p" | dc); fi
let pass=pass+1
done
#/usr/bin/rrdtool update /var/www/rrdtool/temp.rrd 
N:$internal:$inside:$outside
/usr/bin/rrdtool update /var/www/rrdtool/temperature.rrd 
N:$internal:$inside:$outside






The script I use to make the graphs is...
#
# Graph for temperature, Dalmore, Dunedin
# -- DAY
#
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 \
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\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\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\t%8.2lf deg C\n" \
--title "Temperature, Dalmore, Dunedin, New Zealand 9010" \
--base 1000 -r -X 0 \
-s -48h -w 790 -l 0



#
# Graph for temperature, Dalmore, Dunedin
# -- WEEK
#
rrdtool graph /var/www/rrdtool/temperature-week.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 -168h -w 790 -l 0 --lazy

#
# Graph for temperature, Dalmore, Dunedin
# -- MONTH
#
rrdtool graph /var/www/rrdtool/temperature-month.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 -730h -w 790 -l 0 --lazy


#
# 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




The command I used to create the rrd file initially was (i think)...

rrdtool create temperature.rrd DS:internal:GAUGE:864:U:U \
DS:inside:GAUGE:864:U:U \
DS:outside:GAUGE:864:U:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775\
RRA:MAX:0.5:228:797\
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775\
RRA:MIN:0.5:228:797\
RRA:LAST:0.5:1:2



If you can help me, tell me my errors, etc, that would really be great.


Cheers


Max
Dunedin, New Zealand.



More information about the mrtg mailing list