Good plugin

Hi,

Just a small path to make it work with a french environment (colon instead of dot in floating numbers) and bonded machines:

# diff -uw /usr/lib/nagios/plugins/check_memcached check_memcached
— /usr/lib/nagios/plugins/check_memcached 2012-01-16 11:47:41.000000000 +0100
+++ check_memcached 2012-01-16 11:50:58.000000000 +0100
@@ -6,6 +6,12 @@
# Not sure if this script will run on CSH, KSH or other shells
# Anyone who makes it work on those, please let me know.
# Bento Loewenstein
+DOT=true
+
+printf ‘%f’ 0 | grep ‘,’ > /dev/null
+if [ “$?” -eq “0” ] ; then
+ DOT=false
+fi

STATE_OK=0
STATE_WARNING=1
@@ -61,8 +67,12 @@
else
__DISPR=`echo “$__RATE+0.5″|bc -l`
fi
+ if $DOT; then
printf ” %1.0f%%|rate=%1.12g” “$__DISPR” “$__RATE”
else
+ printf ” %1.0f%%|rate=%1.12g” “`echo $__DISPR | sed -e ‘s/./,/g’`” “`echo $__RATE | sed -e ‘s/./,/g’`”
+ fi
+ else
printf ” No rate”
fi
}
@@ -118,7 +128,7 @@

if [ -z “$HSFLAG” ]
then
– HOST=$(/sbin/ifconfig | grep -A1 eth0 | grep inet | sed -e ‘s/.* addr:([^ ]+) .*/1/’)
+ HOST=$(/sbin/ip addr | grep global | head -n 1 | sed -r ‘s/.* (.*)/[0-9]+ .*/1/g’)
fi

case $OPER in

By the way, thanks for your good job !

Rémi