This commit is contained in:
parent
b5743597e2
commit
3869b868da
2 changed files with 70 additions and 0 deletions
30
digitemp/create_digitemp_png.sh
Executable file
30
digitemp/create_digitemp_png.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/sh
|
||||||
|
## aus den per rrdtool datenbank werden hiermit bilder generiert
|
||||||
|
|
||||||
|
nice -n 19 rrdtool graph /var/log/temperatur/temperatur1.png -a PNG -b 1024 --start -129600 -A \
|
||||||
|
-l -10 -u 70 -t "Sensor1" --vertical-label "Grad Celsius" -w 600 -h 200 \
|
||||||
|
DEF:g1=/var/log/temperatur/temperaturen.rrd:Sensor1:AVERAGE \
|
||||||
|
DEF:gmin=/var/log/temperatur/temperaturen.rrd:Sensor1:MIN \
|
||||||
|
DEF:gmax=/var/log/temperatur/temperaturen.rrd:Sensor1:MAX \
|
||||||
|
VDEF:g1a=g1,LAST \
|
||||||
|
VDEF:gmina=gmin,MINIMUM \
|
||||||
|
VDEF:gmaxa=gmax,MAXIMUM \
|
||||||
|
LINE2:g1#ff0000:"Sensor1" \
|
||||||
|
GPRINT:g1a:"aktuell\: %5.2lf °C" \
|
||||||
|
#GPRINT:gdurch:"Durchschnitt\: %5.2lf °C\n" \
|
||||||
|
#GPRINT:gmina:"tiefste\: %5.2lf °C" \
|
||||||
|
#GPRINT:gmaxa:"höchste\: %5.2lf °C" > /dev/null
|
||||||
|
|
||||||
|
nice -n 19 rrdtool graph /var/log/temperatur/temperatur2.png -a PNG -b 1024 --start -129600 -A \
|
||||||
|
-l -10 -u 60 -t "Sensor2" --vertical-label "Grad Celsius" -w 600 -h 200 \
|
||||||
|
DEF:g1=/var/log/temperatur/temperaturen.rrd:Sensor2:AVERAGE \
|
||||||
|
DEF:gmin=/var/log/temperatur/temperaturen.rrd:Sensor2:MIN \
|
||||||
|
DEF:gmax=/var/log/temperatur/temperaturen.rrd:Sensor2:MAX \
|
||||||
|
VDEF:g1a=g1,LAST \
|
||||||
|
VDEF:gmina=gmin,MINIMUM \
|
||||||
|
VDEF:gmaxa=gmax,MAXIMUM \
|
||||||
|
LINE2:g1#ff0000:"Sensor2" \
|
||||||
|
GPRINT:g1a:"aktuell\: %5.2lf °C" \
|
||||||
|
#GPRINT:gdurch:"Durchschnitt\: %5.2lf °C\n" \
|
||||||
|
#GPRINT:gmina:"tiefste\: %5.2lf °C" \
|
||||||
|
#GPRINT:gmaxa:"höchste\: %5.2lf °C" > /dev/null
|
40
digitemp/read_digitemp.sh
Executable file
40
digitemp/read_digitemp.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# dieses script schreibt aktuelle temperaturmesswerte in die rrdtool
|
||||||
|
# datenbankdatei (siehe unten)
|
||||||
|
# (deswegen bestenfalls per crontab aufrufen lassen)
|
||||||
|
#
|
||||||
|
# der user dieses scriptes sollte der gruppe "dialout" angehoeren, um
|
||||||
|
# auf /dev/ttyS0 zugreifen zu koennen
|
||||||
|
#
|
||||||
|
# parameter von digitemp:
|
||||||
|
# -t0 oder -t1 : fragt den ersten oder zweiten Sensor ab
|
||||||
|
# -q : nur die Temperatur ausgeben, keine anderen Informationen
|
||||||
|
# -c/etc/digitemprc : das ist die erstellte Configdatei
|
||||||
|
|
||||||
|
SENSOR1=`digitemp -t0 -q -c/etc/digitemprc | tr -s [:blank:] | cut -f7 -d" "`
|
||||||
|
SENSOR2=`digitemp -t1 -q -c/etc/digitemprc | tr -s [:blank:] | cut -f7 -d" "`
|
||||||
|
rrdtool update /var/log/temperatur/temperaturen.rrd N:$SENSOR1:$SENSOR2
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
#### Vorarbeit ####
|
||||||
|
## 1. digitemp config anlegen (enthaelt IDs der sensoren)
|
||||||
|
digitemp -a -c/etc/digitemprc
|
||||||
|
|
||||||
|
## 2. hiermit wird die rrdtool datenbankdatei einmalig angelegt
|
||||||
|
rrdtool create /var/log/temperatur/temperaturen.rrd --step 60 \
|
||||||
|
DS:Sensor1:GAUGE:120:U:U \
|
||||||
|
DS:Sensor2:GAUGE:120:U:U \
|
||||||
|
RRA:AVERAGE:0.5:1:2160 \
|
||||||
|
RRA:AVERAGE:0.5:5:2016 \
|
||||||
|
RRA:AVERAGE:0.5:15:2880 \
|
||||||
|
RRA:AVERAGE:0.5:60:8760 \
|
||||||
|
RRA:MIN:0.5:1:2160 \
|
||||||
|
RRA:MIN:0.5:5:2016 \
|
||||||
|
RRA:MIN:0.5:15:2880 \
|
||||||
|
RRA:MIN:0.5:60:8760 \
|
||||||
|
RRA:MAX:0.5:1:2160 \
|
||||||
|
RRA:MAX:0.5:5:2016 \
|
||||||
|
RRA:MAX:0.5:15:2880 \
|
||||||
|
RRA:MAX:0.5:60:8760
|
Loading…
Reference in a new issue