Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
ftrahan
byftrahan, December 2, 2013
High. Nice script. Though I found a little bug.
When you clean leading zeros, you clean to many of them and a value of "0.0" becomes ".0" which is not detected by your script...
Here's a patch :
--- check_apcupsd.old 2013-12-02 10:20:28.395006242 -0500
+++ check_apcupsd 2013-12-02 10:20:59.751405840 -0500
@@ -158,7 +158,7 @@
VALUE=`$APCACCESS status $HOSTNAME:$PORT | grep -i ^$ARG | \
sed 's/.*: *\([0-9.][0-9.]*\)[^0-9.].*/\1/'`
-if [ "$VALUE" != "0" ]; then
+if [ "$VALUE" != "0" -a "$VALUE" != "0.0" ]; then
VALUE=`echo $VALUE | sed 's/^0*//'`
fi
ROUNDED=`echo $VALUE | sed 's/\..*//'`
When you clean leading zeros, you clean to many of them and a value of "0.0" becomes ".0" which is not detected by your script...
Here's a patch :
--- check_apcupsd.old 2013-12-02 10:20:28.395006242 -0500
+++ check_apcupsd 2013-12-02 10:20:59.751405840 -0500
@@ -158,7 +158,7 @@
VALUE=`$APCACCESS status $HOSTNAME:$PORT | grep -i ^$ARG | \
sed 's/.*: *\([0-9.][0-9.]*\)[^0-9.].*/\1/'`
-if [ "$VALUE" != "0" ]; then
+if [ "$VALUE" != "0" -a "$VALUE" != "0.0" ]; then
VALUE=`echo $VALUE | sed 's/^0*//'`
fi
ROUNDED=`echo $VALUE | sed 's/\..*//'`