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

check_memcached III

Current Version
0.5
Last Release Date
2010-11-09
Compatible With
  • Nagios 3.x
License
Other
Hits
103348
Files:
FileDescription
check_memcached.tar.gzcheck_memcached 0.5
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
plugin to check memcached's statistics with configurable TCP/IP port and option to check thresholds for any item.

the conofigurable port allows to check memcached instances in diferent ports and other queue managers based on the same protocol, like twitter's kestrel queue manager.

Now using Netcat, thanks to Robert Hugh
To run this plugin it's necessary to have the command "nc" installed.

It was tested only with BASH. To use with other shells, you may need to adjust it. if you do, please let me know.

it assumes memcached's default port if not specified.

V. 0.2: fixed the SED options to work on FreeBSD out of the box. thanks to all who pointed this out.

V. 0.3: there was a problem with division by zero if all the stats were zero. fixed.

v. 0.4: now you can retrieve the value for any individual stat and check for warning/critical levels.

v. 0.5: Applied patch by Robert Hugh, replacing expect by netcat (nc)
Reviews (6)
byowenmarinas, February 29, 2012
no need of except changing the get_stats function to ...

thx
OWen

get_stats()
{
RESULT=`echo "stats" | nc $2 $3`
STATS=`echo "$RESULT" | grep "${1}"|sed -e 's/\r//'`
printf "%s\n" "$STATS"
return $__RET
}
bydarkweaver87, January 15, 2012
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
byblutgens, October 14, 2011
Had to edit the other ("-v other" for connections)function to allow performance data on connections.
bysteve.lippert, April 18, 2011
1 of 1 people found this review helpful
Pretty well written plug-in, but a little slow to execute, at least on my systems (CentOS 5). I lowered the TIMEOUT value on line 24, as a typical plugin run was this value plus 1 second. I also added performance data to "other" checks, so I can graph current items and connections.
bycrberus, September 22, 2010
2 of 2 people found this review helpful
Works great on Linux out of the box.

Requires a slight modification to the sed substitution statement to work on FreeBSD. The substitution requires an '/Ig' instead of '/ig' on FreeBSD to make it case insensitive as desired.

Make sure you have bash and expect installed on FreeBSD in order for this to work. (Not installed by default on a minimal build.)