Author: glen                         Date: Fri Jan 14 10:20:36 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add -I option to allow ignoring by status

---- Files affected:
packages/nagios-plugin-check_ipmi:
   README (1.1 -> 1.2) , check_ipmi (1.10 -> 1.11) , 
nagios-plugin-check_ipmi.spec (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_ipmi/README
diff -u packages/nagios-plugin-check_ipmi/README:1.1 
packages/nagios-plugin-check_ipmi/README:1.2
--- packages/nagios-plugin-check_ipmi/README:1.1        Thu Jan 13 15:39:41 2011
+++ packages/nagios-plugin-check_ipmi/README    Fri Jan 14 11:20:30 2011
@@ -5,6 +5,7 @@
 
 Usage: check_ipmi <filename>
        check_ipmi -i REGEXP <filename>
+       check_ipmi -I STATUS1,STATUS2 <filename>
        check_ipmi -S
        check_ipmi -c
 
@@ -16,6 +17,8 @@
 modules, make device nodes if missing.
 
 Option -S installs sudo rules so you could invoke the check from Nagios Nrpe.
+
+Option -I allows you to ignore certain statuses, line "nc" (Non-Critical) 
being reported as critical.
 
 Option -i allows you to skip sensors which are not interesting to you, or who
 report bad status and you can't change tresholds.

================================================================
Index: packages/nagios-plugin-check_ipmi/check_ipmi
diff -u packages/nagios-plugin-check_ipmi/check_ipmi:1.10 
packages/nagios-plugin-check_ipmi/check_ipmi:1.11
--- packages/nagios-plugin-check_ipmi/check_ipmi:1.10   Thu Jan 13 15:39:41 2011
+++ packages/nagios-plugin-check_ipmi/check_ipmi        Fri Jan 14 11:20:30 2011
@@ -50,6 +50,7 @@
        cat >&2 <<EOF
 Usage: check_ipmi <filename>
        check_ipmi -i 'FAN.*' <filename>
+       check_ipmi -I nc,lnc <filename>
        check_ipmi -S
        check_ipmi -c
 
@@ -61,6 +62,8 @@
        Install sudo rules
     -i
        grep extended regexp which sensors to ignore
+    -I
+       comma separated list of statuses to ignore
 EOF
 }
 
@@ -69,6 +72,18 @@
        echo "$*" | sed -e 's/^ *\| *$//g'
 }
 
+# checks if $status is in comma separated list of $ignore_stats
+ignored_status() {
+       local status="$1"
+       local IFS=","
+       for s in $ignore_status; do
+               if [ "$status" = "$s" ]; then
+                       return 0
+               fi
+       done
+       return 1
+}
+
 # checks if ipmitool is even usable on this system
 check_ipmitool() {
        echo "Checking for IPMI..."
@@ -165,6 +180,10 @@
                shift
                ignore_sensors="$1"
                ;;
+       -I)
+               shift
+               ignore_status="$1"
+               ;;
        -S)
                setup_sudo=1
                ;;
@@ -222,8 +241,14 @@
                echo "ignore $label"
                continue
        fi
+       status=$(trim "$status")
+
+       if ignored_status "$status"; then
+               echo "ignore status $status on $label"
+               continue
+       fi
 
-       case $(trim "$status") in
+       case "$status" in
        ns)
                # skip ns = Disabled
                continue
@@ -233,7 +258,6 @@
                warn_sensors=$((warn_sensors+1))
                label=$(trim "$label")
                result=$(trim "$result")
-               status=$(trim "$status")
                warning="$warning($label, $status, $result) "
                ;;
        ok)
@@ -244,7 +268,6 @@
                crit_sensors=$((crit_sensors+1))
                label=$(trim "$label")
                result=$(trim "$result")
-               status=$(trim "$status")
                critical="$critical($label, $status, $result) "
                ;;
        esac
@@ -252,7 +275,7 @@
 rm -f $t
 
 msg="${critical:+$crit_sensors sensors critical: $critical}"
-msg="${warning:+$warn_sensors sensors warning: $warning}"
+msg="${msg}${warning:+$warn_sensors sensors warning: $warning}"
 if [ $crit_sensors -gt 0 ]; then
        die CRITICAL "$msg"
 fi
@@ -260,7 +283,7 @@
        die WARNING "$msg"
 fi
 
-if [ "$ok_sensors " -le 0 ]; then
+if [ $ok_sensors -le 0 ]; then
        # 0 sensors found OK is likely error
        die UNKNOWN "No sensors found OK"
 fi

================================================================
Index: packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec
diff -u packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.10 
packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.11
--- packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.10        
Thu Jan 13 15:39:41 2011
+++ packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec     Fri Jan 
14 11:20:30 2011
@@ -2,7 +2,7 @@
 %define                plugin  check_ipmi
 Summary:       Nagios plugin to check IPMI status
 Name:          nagios-plugin-%{plugin}
-Version:       1.9
+Version:       1.10
 Release:       1
 License:       GPL v2
 Group:         Networking
@@ -78,6 +78,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.11  2011/01/14 10:20:30  glen
+- add -I option to allow ignoring by status
+
 Revision 1.10  2011/01/13 14:39:41  glen
 - add README
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/README?r1=1.1&r2=1.2&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/check_ipmi?r1=1.10&r2=1.11&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec?r1=1.10&r2=1.11&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to