Here is what I did to get the web control units to report back to RRDTool
First create the database:
# rrdtool create office_temp.rrd -s 300 DS:temp:GAUGE:900:-55:125 RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
Then the script to pull the data:
#!/bin/bash
# get the EPOCH date
DATE=$(/bin/date +%s)
# get temp. Change this to correct location probably /etc/temperatures/
TEMP=$(/bin/cat /etc/temperature/buildings/office/office_temp.txt)
# get to the right directory this is most likely the directory above
cd /etc/temperature/buildings/office/
# get the date from the web control unit for sensor 1.
wget http://192.168.1.16/gett1.cgi --http-user=office --http-password=1qazxsw2
# cat it to a file
cat gett1.cgi > office_temp
# get rid of everything but the numbers
cat office_temp | sed 's/[A-Za-z%]*//g' > office_temp.txt
# remove the original file
rm -f gett1.cgi
# get it into rrd
rrdtool update ../office_temp.rrd $DATE:$TEMP
# create Daily graph
rrdtool graph /var/www/html/temperatures/buildings/office_temp_day.png -s -1day DEF:shop=../office_temp.rrd:temp:AVERAGE LINE1:shop#FF9900 -h 400 -w 600 -y1:2 --color GRID#dddddd --color MGRID#aaaaaa
# create Weekly graph
rrdtool graph /var/www/html/temperatures/buildings/office_temp_week.png -s -1week DEF:shop=../office_temp.rrd:temp:AVERAGE LINE1:shop#FF9900 -h 400 -w 600 -y1:2 --color GRID#dddddd --color MGRID#aaaaaa
# create monthly graph
rrdtool graph /var/www/html/temperatures/buildings/office_temp_month.png -s -1month DEF:shop=../office_temp.rrd:temp:AVERAGE LINE1:shop#FF9900 -h 400 -w 600 -y1:2 --color GRID#dddddd --color MGRID#aaaaaa
# create Yearly graph
rrdtool graph /var/www/html/temperatures/buildings/office_temp_year.png -s -1year DEF:shop=../office_temp.rrd:temp:AVERAGE LINE1:shop#FF9900 -h 400 -w 600 -y1:2 --color GRID#dddddd --color MGRID#aaaaaa
Then Create the web page:
<!DOCTYPE html>
<html>
<body>
<meta http-equiv=”refresh” content=”120″>
<p><b>Office Temperature Daily Graph.</b></p>
<IMG SRC=”buildings/office_temp_day.png” ALT=”Daily Office Humidity Graph” WIDTH=600 HEIGH=400>
</body>
</html>
Maintenance Stuff
To remove drops or spikes first dump the databae to XML:
sudo rrdtool dump shop_temp.rrd shop_temp.xml
Then Edit out the bad data:
sudo vi shop_temp.xml
Save off the original database:
sudo mv shop_temp.rrd shop_temp.rrd.evo
Last restore the database:
sudo rrdtool restore shop_temp.xml shop_temp.rrd
