Network and Systems Management

check_memcached III

Description:

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

Current Version

0.5

Last Release Date

2010-11-09

Compatible With

  • Nagios 3.x

License

Other


Project Files
Project Notes
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) Add a Review
no need of except
by owenmarinas, 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 "%sn" "$STATS" return $__RET }



Good plugin
by darkweaver87, January 31, 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



by blutgens, October 31, 2011




Works Great on Cent OS
by ddusina, May 31, 2011

Had to edit the other ("-v other" for connections)function to allow performance data on connections.



Works well - added some changes for my purposes
by steve.lippert, April 30, 2011

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.



Works great - required adjustments on FreeBSD
by crberus, September 30, 2010

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.)



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.4 (8)
Favorites
1
Views
103,354