add support for warning/critical values
authorChristian Weiske <cweiske@cweiske.de>
Wed, 9 Feb 2011 07:03:34 +0000 (08:03 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 9 Feb 2011 07:03:34 +0000 (08:03 +0100)
munin/README
munin/usb-wde1_

index f8eaf2348c8ded58db844de64ce978f8533c904e..c0ba522a50e300a312be37512ea2ba827004f426 100644 (file)
@@ -68,7 +68,7 @@ $ ln -s usb-wde1_ usb-wde1_humidity
 $ cd ..
 
 
-Running the munin plugin is also relatively easy, and you can easily pass
-the environment configuration variables from the munin configuration
-on the cli:
-$ logfile=test.log sensors="0 1 7" ./munin/usb-wde1_temperature
+Running the munin plugin for development purposes is also relatively easy
+since you can pass the environment configuration variables
+from the munin configuration on the command line:
+$ MUNIN_LIBDIR=/usr/share/munin/ logfile=test.log sensors="0 1 7" ./munin/usb-wde1_temperature
index ada0e2884380681babd442aa758e7bb9df0ff83b..485432b59325ac36a24e16388ca28bbe9b19d9da 100755 (executable)
@@ -22,10 +22,13 @@ usb-wde1 -  Munin plugin to report usb-wde1 temperature and humidity data
   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/plugins/plugin.sh"
+
 TYPE=`basename $0 | sed 's/^.*_//g'`
 
 if [ "$1" = "autoconf" ]; then
@@ -69,7 +79,6 @@ for i in $sensors; do
     code="sensor$i=\${sensor$i:=Sensor $i}"
     eval $code
 done
-# FIXME: Warning/critical values
 
 
 if [ "$1" = "config" ]; 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