rename munin plugin
[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
12 =head2 EXAMPLE CONFIGURATION
13
14  [usb-wde1]
15   env.logfile /var/log/usb-wde1.log
16   env.host_name House
17   env.sensor0 Living room
18   env.sensor1 Kitchen
19
20 =head1 MAGIC MARKERS
21
22  #%# family=manual
23  #%# capabilities=autoconf suggest
24
25 =cut
26
27 # params:
28 # - logfile
29 # - sensor names
30 # - type (temperature / humidity)
31 # - hostname
32
33 if [ "$1" = "autoconf" ]; then
34     if [ -r "$logfile" ]; then
35         echo yes
36     else
37         echo "no (Logfile \"$logfile\" does not exist)"
38     fi
39     exit 0
40
41 elif [ "$1" = "suggest" ]; then
42     echo temperature
43     echo humidity
44     exit 0
45 fi
46
47
48 #load variables
49 TYPE=`basename $0 | sed 's/^.*_//g'`
50
51
52 if [ "$1" = "config" ]; then
53     if [ "$host_name" != "" ]; then
54         echo "host_name $host_name"
55     fi
56     if [ "$TYPE" = "temperature" ]; then
57         echo 'graph_title Temperature'
58         echo 'graph_args --base 1000 --lower-limit -30 --upper-limit 60'
59         echo 'graph_vlabel Temperature'
60     else
61         echo 'graph_title Humidity'
62         echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
63         echo 'graph_vlabel Humidity'
64     fi
65     echo 'graph_scale no'
66     echo 'graph_category sensors'
67     #FIXME: warning/critical values
68 fi