refresh 15_check_sensors_fault.dpatch from upstream

This commit is contained in:
Jan Wagner 2011-09-07 12:23:19 +00:00
parent a99f2309f1
commit 4e419098e2
2 changed files with 28 additions and 21 deletions

4
debian/changelog vendored
View file

@ -9,8 +9,8 @@ nagios-plugins (1.4.15-5) unstable; urgency=low
* Adding 16_check_raduis_fix_format-security.dpatch to fix error in
check_radius when compiling with -Werror=format-security (hardening),
thanks Thomas Guyot-Sionnesti - LP: #837085
* Adding 15_check_sensors_fault.dpatch to detect sensors in FAULT state
(Closes: #615133)
* Adding 15_check_sensors_fault.dpatch to detect sensors in FAULT state,
thank Holger Weiss (Closes: #615133)
* Remove empty /usr/include from nagios-plugins-basic, thanks Ferenc Wagner
(Closes: #630711)

View file

@ -1,33 +1,40 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 15_check_sensors_fault.dpatch by Jan Wagner <waja@cyconet.org>
## 15_check_sensors_fault.dpatch by Holger Weiss <holger@zedat.fu-berlin.de>
##
## DP: Report UNKNOWN if sensor is faulty (fixing #615133)
## From 276c5b98bf619eabd8b0bd5fc3ff60c0a59489a7 Mon Sep 17 00:00:00 2001
## From: Holger Weiss <holger@zedat.fu-berlin.de>
## Date: Wed, 7 Sep 2011 13:55:53 +0200
## Subject: [PATCH] check_sensors: Detect FAULT status
##
## DP: Return an UNKNOWN status if a faulty sensor is detected. This can be
## suppressed with the new "--ignore-fault" option.
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-plugins-1.4.15~/plugins-scripts/check_sensors.sh nagios-plugins-1.4.15/plugins-scripts/check_sensors.sh
--- nagios-plugins-1.4.15~/plugins-scripts/check_sensors.sh 2010-07-27 22:47:16.000000000 +0200
+++ nagios-plugins-1.4.15/plugins-scripts/check_sensors.sh 2011-09-07 11:05:26.000000000 +0200
@@ -10,7 +10,7 @@
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -10,7 +10,7 @@ REVISION="@NP_VERSION@"
print_usage() {
- echo "Usage: $PROGNAME"
+ echo "Usage: $PROGNAME [--ignore-fault]"
+ echo "Usage: $PROGNAME" [--ignore-fault]
}
print_help() {
@@ -57,6 +57,14 @@
@@ -57,9 +57,12 @@ case "$1" in
if echo ${sensordata} | egrep ALARM > /dev/null; then
echo SENSOR CRITICAL - Sensor alarm detected!
exit 2
+ elif echo ${sensordata} | egrep FAULT > /dev/null; then
+ if test "$1" != "-i" -a "$1" != "--ignore-fault"; then
+ echo SENSOR UNKNOWN - Sensor reported fault
+ exit 3
+ else
+ echo sensor ok
+ exit 0
+ fi
else
echo sensor ok
exit 0
- else
- echo sensor ok
- exit 0
+ elif echo ${sensordata} | egrep FAULT > /dev/null \
+ && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
+ echo SENSOR UNKNOWN - Sensor reported fault
+ exit 3
fi
+ echo sensor ok
+ exit 0
;;
esac