8 usb-wde1 - Munin plugin to report usb-wde1 temperature and humidity data
11 The plugin offers two modes: temperature and humidity graphing.
13 Symlink usb-wde1_ as "usb-wde1_temperature" and/or "usb-wde1_humidity".
15 =head2 EXAMPLE CONFIGURATION
18 env.logfile /tmp/usb-wde1-last
21 env.sensor0 Living room
28 #%# capabilities=autoconf suggest
32 Christian Weiske <cweiske@cweiske.de>
37 http://www.gnu.org/licenses/agpl.html
41 TYPE=`basename $0 | sed 's/^.*_//g'`
43 if [ "$1" = "autoconf" ]; then
44 if [ ! -r "$logfile" ]; then
45 echo "no (Logfile \"$logfile\" does not exist)"
46 elif [ "$TYPE" != "temperature" -a "$TYPE" != "humidity" ]; then
47 echo "no (Type \"$TYPE\" not supported, try \"./usb-wde1_ suggest\")"
53 elif [ "$1" = "suggest" ]; then
64 if [ "$sensors" = "" ]; then
65 sensors="0 1 2 3 4 5 6 7"
69 code="sensor$i=\${sensor$i:=Sensor $i}"
72 # FIXME: Warning/critical values
75 if [ "$1" = "config" ]; then
76 if [ "$host_name" != "" ]; then
77 echo "host_name $host_name"
79 if [ "$TYPE" = "temperature" ]; then
80 echo 'graph_title Temperature'
81 #echo 'graph_args --base 1000 --lower-limit -30 --upper-limit 60'
82 echo 'graph_args --base 1000'
83 echo 'graph_vlabel Temperature'
84 echo 'graph_info Shows the temperature of different thermometers'
86 echo 'graph_title Humidity'
87 #echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
88 echo 'graph_args --base 1000'
89 echo 'graph_vlabel Humidity'
90 echo 'graph_info Shows the air humidity of different thermometers (in %)'
93 echo 'graph_category sensors'
95 #FIXME: warning/critical values
97 eval "name=\$sensor$i"
98 echo "sensor$i.label $name"
104 #Beispielausgabe USB-WDE1:
105 # $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0
106 # Doku des Formats in 92030_USB_WDE1_V1.0_UM.pdf bei elv.de verfügbar
107 # Format ist "Logview openformat"
108 # http://www.logview.info/cms/d_formatbeschreibung.phtml
114 read -r sign state timestamp\
115 t0 t1 t2 t3 t4 t5 t6 t7\
116 h0 h1 h2 h3 h4 h5 h6 h7\
117 tc hc ws ns rain checksum\
121 if [ "$sign" != '$1' ]; then
122 echo Log line does not begin with \$1
127 if [ "$timestamp" -lt `expr $curdate - 600` ]; then
128 #timestamp is too old, data are too old
133 if [ "$TYPE" = "temperature" ]; then
140 for i in $sensors; do
141 eval "value=\$$varprefix$i"
142 value=`echo $value|sed s/,/./`
143 echo "sensor$i.value $value"