munin plugin config should work now
[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 if [ "$1" = "autoconf" ]; then
32     if [ -r "$logfile" ]; then
33         echo yes
34     else
35         echo "no (Logfile \"$logfile\" does not exist)"
36     fi
37     exit 0
38
39 elif [ "$1" = "suggest" ]; then
40     echo temperature
41     echo humidity
42     exit 0
43 fi
44
45
46 #load variables
47 TYPE=`basename $0 | sed 's/^.*_//g'`
48
49
50 if [ "$1" = "config" ]; then
51     if [ "$host_name" != "" ]; then
52         echo "host_name $host_name"
53     fi
54     if [ "$TYPE" = "temperature" ]; then
55         echo 'graph_title Temperature'
56         echo 'graph_args --base 1000 --lower-limit -30 --upper-limit 60'
57         echo 'graph_vlabel Temperature'
58         echo 'graph_info Shows the temperature of different thermometers'
59     else
60         echo 'graph_title Humidity'
61         echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
62         echo 'graph_vlabel Humidity'
63         echo 'graph_info Shows the air humidity of different thermometers (in %)'
64     fi
65     echo 'graph_scale no'
66     echo 'graph_category sensors'
67
68     #FIXME: warning/critical values
69
70     exit 0
71 fi