Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

ftrahan

Reviews(1)
byftrahan, December 2, 2013
check_apcupsd
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/\..*//'`