]> mj.ucw.cz Git - arexx.git/blob - web/temp-12h.cgi
Home: New MQTT server
[arexx.git] / web / temp-12h.cgi
1 #!/bin/sh
2 echo "Content-type: image/png"
3 echo
4 D=/var/log/arexxd
5
6 current ()
7 {
8         Z=$(rrdtool fetch $1 AVERAGE -s-5min -r900 | grep : | grep -v nan | tail -1 | cut -d ' ' -f 2)
9         if [ -z "$Z" ] ; then
10                 echo -n "---- "
11         else
12                 printf "%4.1f°" "$Z"
13         fi
14 }
15
16 exec rrdtool graph - \
17         --start 'now-12h' \
18         --end 'now' \
19         --title "Temperature" \
20         -w 720 -h 600 \
21         -x MINUTE:10:HOUR:1:HOUR:2:0:%H:%M \
22         -y 5:1 \
23         --right-axis 1:0 --right-axis-format "%3.0lf" \
24         --units-exponent 0 --lower-limit -20 --upper-limit 40 --rigid \
25         --legend-position east \
26         --pango-markup \
27         DEF:g=$D/sensor-ursarium.rrd:temp:AVERAGE \
28         DEF:u=$D/sensor-kitchen.rrd:temp:AVERAGE \
29         DEF:c=$D/sensor-catarium.rrd:temp:AVERAGE \
30         DEF:m=$D/sensor-garage.rrd:temp:AVERAGE \
31         DEF:a=$D/sensor-aquarium.rrd:temp:AVERAGE \
32         'AREA:u#7777cc' \
33         'AREA:m#77cc77' \
34         'AREA:c#cc77cc' \
35         'AREA:g#cc7777' \
36         'LINE2:g#cc0000:Ursarium\n' \
37         'LINE2:u#0000cc:Kitchen\n' \
38         'LINE2:a#00cccc:Aquarium\n' \
39         'LINE2:c#cc00cc:Catarium\n' \
40         'LINE2:m#00cc00:Garage\n' \
41         'HRULE:0#0000ff' \
42         'COMMENT:\s' \
43         'COMMENT:\s' \
44         'COMMENT:\s' \
45         'COMMENT:<span foreground="#cc0000" font-size="x-large" weight="bold">'"$(current $D/sensor-ursarium.rrd)"'</span>\l' \
46         'COMMENT:\s' \
47         'COMMENT:<span foreground="#0000cc" font-size="x-large" weight="bold">'"$(current $D/sensor-kitchen.rrd)"'</span>\l' \
48         'COMMENT:\s' \
49         'COMMENT:<span foreground="#00cccc" font-size="x-large" weight="bold">'"$(current $D/sensor-aquarium.rrd)"'</span>\l' \
50         'COMMENT:\s' \
51         'COMMENT:<span foreground="#cc00cc" font-size="x-large" weight="bold">'"$(current $D/sensor-catarium.rrd)"'</span>\l' \
52         'COMMENT:\s' \
53         'COMMENT:<span foreground="#00cc00" font-size="x-large" weight="bold">'"$(current $D/sensor-garage.rrd)"'</span>\l' \