packages: nagios-plugin-check_ipmi/check_ipmi, nagios-plugin-check_ipmi/nag...

glen glen at pld-linux.org
Thu Jan 13 14:18:05 CET 2011


Author: glen                         Date: Thu Jan 13 13:18:05 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add support to ignore sensors by grep extended regexp
- count non-critical sensors as warning
- nc ignore reverted

---- Files affected:
packages/nagios-plugin-check_ipmi:
   check_ipmi (1.8 -> 1.9) , nagios-plugin-check_ipmi.spec (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_ipmi/check_ipmi
diff -u packages/nagios-plugin-check_ipmi/check_ipmi:1.8 packages/nagios-plugin-check_ipmi/check_ipmi:1.9
--- packages/nagios-plugin-check_ipmi/check_ipmi:1.8	Wed Jan 12 12:21:06 2011
+++ packages/nagios-plugin-check_ipmi/check_ipmi	Thu Jan 13 14:18:00 2011
@@ -158,6 +158,10 @@
 	-c)
 		check_ipmitool=1
 		;;
+	-i)
+		shift
+		ignore_sensors="$1"
+		;;
 	-S)
 		setup_sudo=1
 		;;
@@ -203,39 +207,59 @@
 # Fan 4            | 29.40 unspecifi   | nc
 # Fans             | 0 unspecified     | nc
 
-osensors=0
-bsensors=0
-bad_sensors=''
+ok_sensors=0
+warn_sensors=0
+crit_sensors=0
+critical=''
+warning=''
 oIFS=$IFS IFS='|'
 while read label result status; do
+	# check for ignored sensors
+	if trim "$label" | grep -qE "^($ignore_sensors)$"; then
+		echo "ignore $label"
+		continue
+	fi
+
 	case $(trim "$status") in
-	ns|nc)
+	ns)
 		# skip ns = Disabled
-		# skip nc = Non Critical
 		continue
 		;;
+	nc)
+		# Non Critical -> warning
+		warn_sensors=$((warn_sensors+1))
+		label=$(trim "$label")
+		result=$(trim "$result")
+		status=$(trim "$status")
+		warning="$warning($label, $status, $result) "
+		;;
 	ok)
-		# just count them
-		osensors=$((osensors+1))
+		# count ok
+		ok_sensors=$((ok_sensors+1))
 		;;
 	*)
-		bsensors=$((bsensors+1))
+		crit_sensors=$((crit_sensors+1))
 		label=$(trim "$label")
 		result=$(trim "$result")
 		status=$(trim "$status")
-		bad_sensors="$bad_sensors($label, $status, $result) ";
+		critical="$critical($label, $status, $result) "
 		;;
 	esac
 done < $t
 rm -f $t
 
-if [ "$bad_sensors" ]; then
-	die CRITICAL "$bsensors sensors bad: $bad_sensors"
+msg="${critical:+$crit_sensors sensors critical: $critical}"
+msg="${warning:+$warn_sensors sensors warning: $warning}"
+if [ $crit_sensors -gt 0 ]; then
+	die CRITICAL "$msg"
+fi
+if [ $warn_sensors -gt 0 ]; then
+	die WARNING "$msg"
 fi
 
-if [ "$osensors " -le 0 ]; then
+if [ "$ok_sensors " -le 0 ]; then
 	# 0 sensors found OK is likely error
 	die UNKNOWN "No sensors found OK"
 fi
 
-die OK "$osensors sensors OK"
+die OK "$ok_sensors sensors OK"

================================================================
Index: packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec
diff -u packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.7 packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.8
--- packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec:1.7	Wed Jan 12 12:21:06 2011
+++ packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec	Thu Jan 13 14:18:00 2011
@@ -2,7 +2,7 @@
 %define		plugin	check_ipmi
 Summary:	Nagios plugin to check IPMI status
 Name:		nagios-plugin-%{plugin}
-Version:	1.8
+Version:	1.9
 Release:	1
 License:	GPL v2
 Group:		Networking
@@ -73,6 +73,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.8  2011/01/13 13:18:00  glen
+- add support to ignore sensors by grep extended regexp
+- count non-critical sensors as warning
+- nc ignore reverted
+
 Revision 1.7  2011/01/12 11:21:06  glen
 - skip "nc" (Non-Critical)
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/check_ipmi?r1=1.8&r2=1.9&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/nagios-plugin-check_ipmi.spec?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list