Home Directory Plugins Software check_memcached.pl

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

check_memcached.pl

Current Version
0.83
Last Release Date
2013-03-30
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
Owner
License
GPL
Hits
93011
Files:
FileDescription
check_memcached.plcheck_memcached.pl - version 0.83 (Mar 2013) - 0.8x are last versions with integrated library
check_memcached.phpcheck_memcached.php - Template for PNP4Nagios
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This is Memcached Check plugin. It gets stats variables and allows to set thresholds on their value or their rate of change. It can measure response time, calculate hitrate, memory utilization and other data. It also returns status variables as perfomance data for processing and you can find graph template for PNP4Nagios here as well.
This plugin checks Memcached and measures response which can be used for threshold checks. It also retrieves various statistics data available with memcache 'stats' command (what you get when you telnet to the port and do 'stats') and allows to set thresholds either on their direct values or on the rate of change of those variables. Plugin calculates and allows to set threshold on useful statistics like Hitrate (based on rate of change unlike all other plugins that do it based on totals for all time) and Memory Utilization. All data can become performance data for graphing and pnp4nagios template is available.

For help on what parameters this plugin accepts you can just do ./check_memcached.pl --help

Extensive documentation is also available in the header of plugin perl code that you should read.

Sample command and service definitions are below:

define command {
command_name check_memcached
command_line $USER1$/check_memcached.pl -H $HOSTADDRESS$ -p $ARG1$ -T $ARG2$ -R $ARG3$ -U $ARG4$ -a curr_connections,evictions -w ~,~ -c ~,~ -f -A 'utilization,hitrate,response_time,curr_connections,evictions,cmd_set,bytes_written,curr_items,uptime,rusage_system,get_hits,total_connections,get_misses,bytes,time,connection_structures,total_items,limit_maxbytes,rusage_user,cmd_get,bytes_read,threads,rusage_user_ms,rusage_system_ms,cas_hits,conn_yields,incr_misses,decr_misses,delete_misses,incr_hits,decr_hits,delete_hits,cas_badval,cas_misses,cmd_flush,listen_disabled_num,accepting_conns,pointer_size,pid' -P "$SERVICEPERFDATA$"
}

# Arguments and thresholds are:
# ARG1 : Port
# ARG2 : Hitrate Threshold. Below it is <60% for warning, <30% for critical
# ARG3 : Response Time Threshold. Below it is >0.1s for WARNING, >0.2s for critical
# ARG4 : Utilization/Size Threshold. Below it is >95% for warning, >98% for critical

define service {
use prod-service
service_description Memcached: Port 11212
check_command check_memcached!11212!'>0.1,>0.2'!'<60,<30'!'>95,>98'
hostgroups memcached
}
Reviews (4)
byamaramrahul, March 17, 2014
It is possible that while connecting to memcached server, connect timeout might occur. To overcome this, modify check_memcached.pl to increase the connect timeout from its default value of 0.25 seconds as below:

$memd = new Cache::Memcached { 'servers' => [ $dsn ], 'connect_timeout' => 1 };

Ref: http://search.cpan.org/~dormando/Cache-Memcached-1.30/lib/Cache/Memcached.pm#CONSTRUCTOR
byiiro, July 31, 2013
The best Memcached monitoring plugin I have found.

However - we just changed to mod_gearman setup and it really looks the Perl script is misbehaving now some reason (it doesn´t understand the characters - there´s always a problem with them).

If anyone has an idea - please share.
bytsaswinkumar, April 16, 2013
MEMCACHED CRITICAL - Hit checked: NG

Here NG - represents what ?
byhypnoz, August 23, 2012
1 of 2 people found this review helpful
This is great, I can tell you put a lot of time into this check and I appreciate it.

I wasn't totally sure where to put the check_memcached.php file, so I just put it into /usr/local/pnp4nagios/share/templates.dist/ and did a nagios reload. Maybe you could make a note of where that file goes.

Thanks for the examples they really helped out while putting this check into nagios configs. One thing I tweaked which is just being anal, is I switched the -R and -U order since the check output info matches -p,-T,-U,-R format.

Not often you find such detailed work for pnp4nagios graphing on top of a check. Thanks again!