[rrd-users] Average/Min/Max

Nunners james at webit.co.uk
Tue Jan 5 09:57:22 CET 2010


I’ve recently changed from using mrtg to using rrdtool, and am having
problems with the averages, min and max.

The example I’ll use relates to me graphing the outside temperature, I have
an xml feed from my little weather station, which produces the temperature
and dew point therefore there are two readings to be stored and then graphed
etc…

rrdtool create weather_temp.rrd --start 1162636707
DS:temp:GAUGE:600:-100:100 RRA:AVERAGE:0.5:1:24 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: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
rrdtool create weather_dewpoint.rrd --start 1162636707
DS:temp:GAUGE:600:-100:100 RRA:AVERAGE:0.5:1:24 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: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

A cron updates them appropriately every 5 mins.

I’ve then got a graph which adds both value on, really nicely:
/usr/bin/rrdtool graph /var/www/mrtg/weather_temp-day.png --start -86400
--vertical-label oC
DEF:temperature_area=/etc/mrtg/weather_temp.rrd:temp:AVERAGE
DEF:temperature=/etc/mrtg/weather_temp.rrd:temp:AVERAGE
DEF:dewpoint=/etc/mrtg/weather_windchill.rrd:temp:AVERAGE
AREA:temperature_area#00FF00 LINE1:temperature#0000FF:"Temperature"
LINE2:dewpoint#FF0000:"Dew Point"

The problem I’m having is on the page I display the graph, I also want the
max min and average temperatures for the graph being displayed (I have day,
week, month, year and “historical” – using the complete set of data
available)… I am therefore trying to call:
MAX: /usr/bin/rrdtool fetch /etc/mrtg/weather_temp.rrd MAX --start -86400
AVERAGE: /usr/bin/rrdtool fetch /etc/mrtg/weather_temp.rrd AVERAGE --start
-86400
MIN: /usr/bin/rrdtool fetch /etc/mrtg/weather_temp.rrd MIN --start -86400

All I get back is the following:
1262680200: nan
1262680200: nan
1262680200: nan

I haven't included the html/php stuff, as obviously it's irrelevant to the
direct problem but I know that all works!  I’m guessing it’s something to do
with when the data started and it not recognising the null values –
therefore what’s the easiest way to get it to ignore the null values?

Thanks
James



-- 
View this message in context: http://n2.nabble.com/Average-Min-Max-tp4254190p4254190.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.



More information about the rrd-users mailing list