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
25 Warning/critical values for all sensors:
29 Warning/critical values for single sensors:
30 env.sensor7_warning 40
31 env.sensor7_critical 50
35 Christian Weiske <cweiske@cweiske.de>
40 http://www.gnu.org/licenses/agpl.html
45 #%# capabilities=autoconf suggest
49 . ${MUNIN_LIBDIR:=/usr/share/munin}/plugins/plugin.sh
51 TYPE=`basename $0 | sed 's/^.*_//g'`
53 if [ "$1" = "autoconf" ]; then
54 if [ ! -r "$logfile" ]; then
55 echo "no (Logfile \"$logfile\" does not exist)"
56 elif [ "$TYPE" != "temperature" -a "$TYPE" != "humidity" ]; then
57 echo "no (Type \"$TYPE\" not supported, try \"./usb-wde1_ suggest\")"
63 elif [ "$1" = "suggest" ]; then
74 if [ "$sensors" = "" ]; then
75 sensors="0 1 2 3 4 5 6 7"
79 code="sensor$i=\${sensor$i:=Sensor $i}"
84 if [ "$1" = "config" ]; then
85 if [ "$host_name" != "" ]; then
86 echo "host_name $host_name"
88 if [ "$TYPE" = "temperature" ]; then
89 echo 'graph_title Temperature'
90 #echo 'graph_args --base 1000 --lower-limit -30 --upper-limit 60'
91 echo 'graph_args --base 1000'
92 echo 'graph_vlabel Temperature'
93 echo 'graph_info Shows the temperature of different thermometers'
95 echo 'graph_title Humidity'
96 #echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
97 echo 'graph_args --base 1000'
98 echo 'graph_vlabel Humidity'
99 echo 'graph_info Shows the air humidity of different thermometers (in %)'
101 echo 'graph_scale no'
102 echo 'graph_category sensors'
104 for i in $sensors; do
105 eval "name=\$sensor$i"
106 echo "sensor$i.label $name"
107 print_warning "sensor$i"
108 print_critical "sensor$i"
114 #Beispielausgabe USB-WDE1:
115 # $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0
116 # Doku des Formats in 92030_USB_WDE1_V1.0_UM.pdf bei elv.de verfügbar
117 # Format ist "Logview openformat"
118 # http://www.logview.info/cms/d_formatbeschreibung.phtml
124 read -r sign state timestamp\
125 t0 t1 t2 t3 t4 t5 t6 t7\
126 h0 h1 h2 h3 h4 h5 h6 h7\
127 tc hc ws ns rain checksum\
131 if [ "$sign" != '$1' ]; then
132 echo Log line does not begin with \$1
137 if [ "$timestamp" -lt `expr $curdate - 600` ]; then
138 #timestamp is too old, data are too old
143 if [ "$TYPE" = "temperature" ]; then
150 for i in $sensors; do
151 eval "value=\$$varprefix$i"
152 value=`echo $value|sed s/,/./`
153 echo "sensor$i.value $value"