Home Directory Plugins Databases check_redis.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

Directory Tree

check_redis.pl

Current Version
0.73
Last Release Date
2013-03-30
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
Owner
License
GPL
Hits
117415
Files:
FileDescription
check_redis.plcheck_redis.pl - version 0.73 (Mar 30, 2013) - 0.7x are last versions with integrated library
check_redis.phpcheck_redis.php - Redis 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 Redis Server Check plugin. It gets stats variables and allows to set thresholds on their value or their rate of change. It can measure response time, hitrate, memory utilization, check replication sync and much more.You can also query specific key and set thresholds on its value or max/min/avg if its a range. All data is returned as performance variables for graphing and pnp4nagios template is included here.
Make sure to install Redis perl library from CPAN first.

Next for help and to see what parameters this plugin accepts do:
./check_redis.pl --help

This plugin checks Redis NoSQL database status varialbes, measures its response time and if specified allows to set thresholds on one or more key data. You can set thresholds for data in stats varialbles and some of them are also conveniently available as long options with special threshold syntax. Plugin also calculates statistics such as Hitrate (calculated as rate of change of hits/misses) and memory use and can check replication delay.

All variables can be returned as performance data for graphing and pnp4nagios template should be available with this plugin on the site you downloaded it from.

Header of the plugin contains extended documentation on how to use it.

Example of Nagios Config Definitions:

define command {
command_name check_redis_new
command_line $USER1$/check_redis.pl -H $HOSTADDRESS$ -p $ARG1$ -T $ARG2$ -R -A -M $_HOSTSYSTEM_MEMORY$ -m $ARG3$ -a $ARG4$ -w $ARG5$ -c $ARG6$ -f -P "$SERVICEPERFDATA$"
}

# Arguments and thresholds are:
# $ARG1 : Port
# $ARG2 : response time thresholds
# $ARG3 : memory utilization thresholds
# $ARG4 : additional variables to be checked
# $ARG5 : warning thresholds for those variables
# $ARG6 : critical thresholds for those variables

define service {
use prod-service
hostgroups redishosts
service_description Redis
check_command check_redis_new!6379!"1,2"!"80,90"!blocked_clients,connected_clients!50,~!100,~
}

define host {
use prod-server
host_name redis.mynetwork
address redis.mynetwork
alias Redis Stat Server
hostgroups linux,redishosts
_SYSTEM_MEMORY '8G'
}

Example of command-line use:

/usr/lib/nagios/plugins/check_redis.pl -H localhost -a 'connected_clients,blocked_clients' -w ~,~ -c ~,~ -m -M 4G -A -R -T -f -v

In above the -v option means "verbose" and with it plugin will output some debugging information about what it is doing. The option is not intended to be used when plugin
is called from nagios itself.

Example of using query and varialbe-based long options with debug enabled as well (-v):

./check_redis.pl -H localhost -p 6379 -D 1 --query LRANGE:AVG:0:,MyColumn1:Q1,ABSENT:WARNING,WARN:300,CRIT:500,DISPLAY:YES,PERF:NO --query GET,MyKey:K1,ABSENT:CRITICAL "--connected_clients=WARN:<2,CRIT:>100,ZERO:OK,ABSENT:WARNING,DISPLAY:YES,PERF:YES"
Reviews (3)
byNapsty, April 28, 2014
Excellent work, very nice plugin, good documentation (within the plugin). It's a nice "feature" that I can run the same command to check for the replication on both master and slave and that it automatically detects the slave:

On MASTER:
./check_redis.pl -H localhost -r -f
OK: REDIS 2.6.16 on localhost:6379 has 1 databases (db0) with 9116 keys, up 87 days 13 hours

On SLAVE:
./check_redis.pl -H localhost -r -f
OK: REDIS 2.6.16 on localhost:6379 has 1 databases (db0) with 9126 keys, up 87 days 6 hours - replication_delay is 0 | replication_delay=0
by-yom-, July 4, 2013
it does everything you need. had troubles with cpan when compiling perl-Redis but managed to make it work.
This check works perfect with NRPE.
Tip when you need to use "", put them with simple quotes in your nrpe_command.cfg and not in $ARGx$

for example : command[check_redis]=/usr/lib64/nagios/plugins/check_redis.pl -H localhost -p $ARG1$ -M $ARG2$ -m $ARG3$,$ARG4$ -R '
bydarfnader, July 18, 2012
1 of 1 people found this review helpful
Everything you need is right here. It is exceptionally flexible and put together. I particularly like the flexibility of how you can shape the perfdata output. Be sure to go to https://github.com/willixix/WL-NagiosPlugins to get the latest code, his other plugins, and supporting graphing tools.