]> mj.ucw.cz Git - arexx.git/commitdiff
Home: Experiments with displaying current numeric values in the graph
authorMartin Mares <mj@ucw.cz>
Sat, 26 Jan 2013 23:20:26 +0000 (00:20 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 26 Jan 2013 23:20:26 +0000 (00:20 +0100)
web/temp-12h.cgi

index 4ea9dc256a903efaae1f033df659ccb17abdce39..2c311e5668ed678d3de9345381a7c282918a6ede 100755 (executable)
@@ -2,6 +2,17 @@
 echo "Content-type: image/png"
 echo
 D=/var/log/arexxd
+
+current ()
+{
+       Z=$(rrdtool fetch $1 AVERAGE -s-5min -r900 | grep : | grep -v nan | tail -1 | cut -d ' ' -f 2)
+       if [ -z "$Z" ] ; then
+               echo -n "---"
+       else
+               printf "%5.1f" "$Z"
+       fi
+}
+
 exec rrdtool graph - \
        --start 'now-12h' \
        --end 'now' \
@@ -12,6 +23,7 @@ exec rrdtool graph - \
        --right-axis 1:0 --right-axis-format "%3.0lf" \
        --units-exponent 0 --lower-limit -20 --upper-limit 40 --rigid \
        --legend-position east \
+       --pango-markup \
        DEF:c=$D/sensor-catarium.rrd:temp:AVERAGE \
        DEF:u=$D/sensor-ursarium.rrd:temp:AVERAGE \
        DEF:b=$D/sensor-balcony.rrd:temp:AVERAGE \
@@ -23,7 +35,19 @@ exec rrdtool graph - \
        'AREA:o#77cc77' \
        'LINE2:c#cc0000:Catarium\n' \
        'LINE2:u#0000cc:Ursarium\n' \
+       'LINE2:t#00cccc:Aquarium\n' \
        'LINE2:b#cc00cc:Balcony\n' \
        'LINE2:o#00cc00:Outside\n' \
-       'LINE2:t#00cccc:Aquarium' \
-       'HRULE:0#0000ff'
+       'HRULE:0#0000ff' \
+       'COMMENT:\s' \
+       'COMMENT:\s' \
+       'COMMENT:\s' \
+       'COMMENT:<span foreground="#cc0000" font-size="x-large" weight="bold">'"$(current $D/sensor-catarium.rrd)"' °C</span>\l' \
+       'COMMENT:\s' \
+       'COMMENT:<span foreground="#0000cc" font-size="x-large" weight="bold">'"$(current $D/sensor-ursarium.rrd)"' °C</span>\l' \
+       'COMMENT:\s' \
+       'COMMENT:<span foreground="#00cccc" font-size="x-large" weight="bold">'"$(current $D/sensor-aquarium.rrd)"' °C</span>\l' \
+       'COMMENT:\s' \
+       'COMMENT:<span foreground="#cc00cc" font-size="x-large" weight="bold">'"$(current $D/sensor-balcony.rrd)"' °C</span>\l' \
+       'COMMENT:\s' \
+       'COMMENT:<span foreground="#00cc00" font-size="x-large" weight="bold">'"$(current $D/sensor-outside.rrd)"' °C</span>\l' \