Store logged data in spool directory
[usb-wde1-tools.git] / munin / usb-wde1_
index ada0e2884380681babd442aa758e7bb9df0ff83b..3c75c72d43378cdca9baf144cbd76620cc7c6088 100755 (executable)
@@ -15,17 +15,20 @@ usb-wde1 -  Munin plugin to report usb-wde1 temperature and humidity data
 =head2 EXAMPLE CONFIGURATION
 
  [usb-wde1_*]
-  env.logfile /tmp/usb-wde1-last
+  env.logfile /var/spool/usb-wde1/usb-wde1-last
   env.host_name House
   env.sensors 0 1 7
   env.sensor0 Living room
   env.sensor1 Kitchen
   env.sensor7 Outside
 
-=head1 MAGIC MARKERS
+ Warning/critical values for all sensors:
+  env.warning 10
+  env.critical 5
 
- #%# family=manual
- #%# capabilities=autoconf suggest
+ Warning/critical values for single sensors:
+  env.sensor7_warning 40
+  env.sensor7_critical 50
 
 =head1 AUTHOR
 
@@ -36,8 +39,15 @@ Christian Weiske <cweiske@cweiske.de>
 AGPL
 http://www.gnu.org/licenses/agpl.html
 
+=head1 MAGIC MARKERS
+
+ #%# family=manual
+ #%# capabilities=autoconf suggest
+
 =cut
 
+. ${MUNIN_LIBDIR:=/usr/share/munin}/plugins/plugin.sh
+
 TYPE=`basename $0 | sed 's/^.*_//g'`
 
 if [ "$1" = "autoconf" ]; then
@@ -69,11 +79,10 @@ for i in $sensors; do
     code="sensor$i=\${sensor$i:=Sensor $i}"
     eval $code
 done
-# FIXME: Warning/critical values
 
 
 if [ "$1" = "config" ]; then
-    if [ "$host_name" != "" ]; then
+    if [ "x$host_name" != "x" ]; then
         echo "host_name $host_name"
     fi
     if [ "$TYPE" = "temperature" ]; then
@@ -92,10 +101,11 @@ if [ "$1" = "config" ]; then
     echo 'graph_scale no'
     echo 'graph_category sensors'
 
-    #FIXME: warning/critical values
     for i in $sensors; do
         eval "name=\$sensor$i"
         echo "sensor$i.label $name"
+        print_warning "sensor$i"
+        print_critical "sensor$i"
     done
 
     exit 0