all: graph

update:
	rrdtool update temp.rrd `echo -n "N:"; /bin/cat /var/www/html/25/dump`

create:
	rrdtool create temp.rrd \
	DS:t:GAUGE:600:U:U \
	DS:h:GAUGE:600:U:U \
	RRA:AVERAGE:0.5:1:1200 \
	RRA:MIN:0.5:12:2400 \
	RRA:MAX:0.5:12:2400 \
	RRA:AVERAGE:0.5:12:2400

fetch:
	rrdtool fetch temp.rrd AVERAGE


graph:
	rrdtool graph temp.png -w 597 -h 132 \
        $(COLOR) --start end-1d \
        --title="t/h" -Y \
        --vertical-label "Temp" \
        DEF:t=temp.rrd:t:AVERAGE \
        DEF:h=temp.rrd:h:AVERAGE \
        LINE1:t#808000:"Temp" \
        LINE1:h#000080:"Humi"


	rrdtool graph temp-w.png -w 597 -h 132 \
        $(COLOR) --start end-1w \
        --title="t/h" -Y \
        --vertical-label "Temp" \
        DEF:t=temp.rrd:t:AVERAGE \
        DEF:h=temp.rrd:h:AVERAGE \
        LINE1:t#808000:"Temp" \
        LINE1:h#000080:"Humi"

	rrdtool graph temp-m.png -w 597 -h 132 \
        $(COLOR) --start end-1m \
        --title="t/h" -Y \
        --vertical-label "Temp" \
        DEF:t=temp.rrd:t:AVERAGE \
        DEF:h=temp.rrd:h:AVERAGE \
        LINE1:t#808000:"Temp" \
        LINE1:h#000080:"Humi"

	rrdtool graph temp-y.png -w 597 -h 132 \
        $(COLOR) --start end-1y \
        --title="t/h" -Y \
        --vertical-label "Temp" \
        DEF:t=temp.rrd:t:AVERAGE \
        DEF:h=temp.rrd:h:AVERAGE \
        LINE1:t#808000:"Temp" \
        LINE1:h#000080:"Humi"
