From: Christian Weiske Date: Wed, 9 Feb 2011 07:03:34 +0000 (+0100) Subject: add support for warning/critical values X-Git-Tag: v1.0.0~23 X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/commitdiff_plain/86ce4bf61aba21124eab2e405f39283e0d7fc591?ds=sidebyside add support for warning/critical values --- diff --git a/munin/README b/munin/README index f8eaf23..c0ba522 100644 --- a/munin/README +++ b/munin/README @@ -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 diff --git a/munin/usb-wde1_ b/munin/usb-wde1_ index ada0e28..485432b 100755 --- a/munin/usb-wde1_ +++ b/munin/usb-wde1_ @@ -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 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