[rrd-users] Graphing average temperatures

Petteri Matilainen pmatil at gmail.com
Wed Nov 21 19:17:27 CET 2007


Hi all,

I'm currently graphing daily, weekly, monthly and yearly inside and outside
temperatures. The temperature values are fetched from SQL database and then
put into temperatures.rrd. I have a cron job that runs this every 5 minutes.
Then I wanted to graph average temperatures too. I didn't think of any other
way but to read average temps from temperatures.rrd and them into a new rrd,
averages.rrd. Then I graph averages.rrd as usual. Can anyone think of a
better way to do this? I suppose average data could be in the same
temperatures.rrd but that's irrelevant at the moment.

temperatures.rrd:

rrdtool create /var/digitemp/temperature.rrd
DS:out:GAUGE:600:-50:50
DS:in:GAUGE:600:-50:50
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:MIN:0.5:1:600 RRA:MIN:0.5:6:700
RRA:MIN:0.5:24:775 RRA:MIN: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:288:797

averages.rrd:

rrdtool create /var/digitemp/averages.rrd \
DS:dayout:GAUGE:600:-50:50 \
DS:dayin:GAUGE:600:-50:50 \
DS:weekout:GAUGE:600:-50:50 \
DS:weekin:GAUGE:600:-50:50 \
DS:mnthout:GAUGE:600:-50:50 \
DS:mnthin:GAUGE:600:-50:50 \
DS:yearout:GAUGE:600:-50:50 \
DS:yearin:GAUGE:600:-50:50 \
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:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN: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:288:797

script:

rrdtool update /var/digitemp/temperatures.rrd N:$out:... etc.

dayout=`rrdtool graph /etc/digitemp/foo
DEF:Out=/var/digitemp/temperature.rrd:out:AVERAGE VDEF:gav=Out,AVERAGE
PRINT:gav:"%5.2lf" -s -1day | tail -n1 | awk '{print $1}'`

etc...

rrdtool update /var/digitemp/averages.rrd N:$dayout:... etc.

(graphing...)

Problem is, at exactly 9:15 in the morning, this script stops updating the
averages.rrd (all values are "nan") and starts again at 5:15 in the
afternoon. I have no idea why. Any ideas are appreciated.

cheers,

Petteri Matilainen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20071121/bb86aea1/attachment.html 


More information about the rrd-users mailing list