c077ea285280c5b919fc6984d640dd8c8d3532de
[usb-wde1-tools.git] / munin / usb-wde1_
1 #!/bin/sh
2 # -*- sh -*-
3
4 : << =cut
5
6 =head1 NAME
7
8 usb-wde1 -  Munin plugin to report usb-wde1 temperature and humidity data
9
10 =head1 CONFIGURATION
11  The plugin offers two modes: temperature and humidity graphing.
12
13  Symlink usb-wde1_ as "usb-wde1_temperature" and/or "usb-wde1_humidity".
14
15 =head2 EXAMPLE CONFIGURATION
16
17  [usb-wde1_temperature]
18   env.logfile /var/log/usb-wde1.log
19   env.host_name House
20   env.sensors 0 1 2 3 4 7
21   env.sensor0 Living room
22   env.sensor1 Kitchen
23
24 =head1 MAGIC MARKERS
25
26  #%# family=manual
27  #%# capabilities=autoconf suggest
28
29 =cut
30
31 TYPE=`basename $0 | sed 's/^.*_//g'`
32
33 if [ "$1" = "autoconf" ]; then
34     if [ ! -r "$logfile" ]; then
35         echo "no (Logfile \"$logfile\" does not exist)"
36     elif [ "$TYPE" != "temperature" -a "$TYPE" != "humidity" ]; then
37         echo "no (Type \"$TYPE\" not supported, try \"./usb-wde1_ suggest\")"
38     else
39         echo yes
40     fi
41     exit 0
42
43 elif [ "$1" = "suggest" ]; then
44     echo temperature
45     echo humidity
46     exit 0
47 fi
48
49
50 #load variables
51
52
53 if [ "$1" = "config" ]; then
54     if [ "$host_name" != "" ]; then
55         echo "host_name $host_name"
56     fi
57     if [ "$TYPE" = "temperature" ]; then
58         echo 'graph_title Temperature'
59         echo 'graph_args --base 1000 --lower-limit -30 --upper-limit 60'
60         echo 'graph_vlabel Temperature'
61         echo 'graph_info Shows the temperature of different thermometers'
62     else
63         echo 'graph_title Humidity'
64         echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
65         echo 'graph_vlabel Humidity'
66         echo 'graph_info Shows the air humidity of different thermometers (in %)'
67     fi
68     echo 'graph_scale no'
69     echo 'graph_category sensors'
70
71     #FIXME: warning/critical values
72
73     exit 0
74 fi