Monitor Redis Service with Nagios Monitoring tool

Monitor Redis service with Nagios

In this article, we are going to monitor Redis Service with most popular monitoring tool called Nagios Monitoring.
I hope you already install Nagios server and NRPE Service if not or you are new who just started working on Nagios then refer below links which help you to clear your doubts regarding Nagios Application.


Read : How to install and configure Nagios Monitoring Server?
Read : How to add a remote host on Nagios server for monitoring?

Default Nagios plugins installation only provide you some plugins which help us to monitor default services and application on the server. In such case, we need to install custom plugins which help us to monitor particular services and applications on Server.

Redis

         Is very important part of the caching mechanism. It helps to improve the speed of your website as well as performance. It is our duty to keep an eye on service running properly or not and also this thing we can monitor through Nagios by using the simple custom plugin on a host server.


Below are the parameters we are going to monitor about Redis :

  • Check_redis_procs
  • Check_redis_mem
  • check_redis_clients


Configuration of Redis Custom Plugin

Step 1 : Install Dependency package

To run custom plugin of redis you need to first install dependency package on the server which supports Redis plugin. Run below command to install package,

  • cpan install Redis

Step 2 : Download Redis custom Plugin

Now download redis custom plugin which is use to fetch or monitor Redis service on the host server.
Download Plugin from below link,

Step 3 : Permissions

Give executable permission to check_redis.pl plugin using below commands,

  • chmod +x check_redis.pl

Step 4 : Configure Redis plugin

Open file “nrpe.cfg” which basically resides under /etc/nagios. Add below redis monitoring command which helps to fetch information from the host server and send it to Nagios server.

Vim /etc/nagios/nrpe.cfg

## Monitor Redis Service

command[check_redis_procs]=/usr/local/nagios/libexec/check_redis.pl -H localhost -p 6379 -t ping


command[check_redis_mem]=/usr/local/nagios/libexec/check_redis.pl -H localhost -a --used_memory_rss=WARN:700000000,CRIT:1000000000


command[check_redis_clients]=/usr/local/nagios/libexec/check_redis.pl -H localhost -a --connected_clients=WARN:1000,CRIT:1500

save and close the file.

Check_redis_procs : This is used to monitor Redis service running status means it is running or stop. This command will continuously ping redis port and check its working or not.

Check_redis_mem : Number of bytes that Redis allocated as seen by the operating system means how much memory or ram is allocated by redis service and how much is remaining on the server. Here in warning and critical provide value as per your requirement.

Check_redis_clients : this command will check how many no. of clients connected on redis sever. The threshold value for warning and critical I used here 1000 and 1500 clients you can use as per your requirement.

Note : You can also monitor multiple parameters from Redis service. Above three are most important parameters to monitor.
To check some other parameters with their threshold values use below help command.

  • /usr/local/nagios/libexec/check_redis.pl --help

Step 5 : Configuration on Nagios Server

Now come to Nagios server and go to the “/usr/local/nagios/etc/” directory. Create a file under remote host directory which I already explained in the previous article.
For more understanding refer link,

Here i have created file in "/usr/local/nagios/etc/clients" directory with name of redis-service-hosts.cfg

Vim /usr/local/nagios/etc/clients/redis-service-hosts.cfg

## Add below Service’s

define service{
                      use   generic-service
                      host_name   nagios_host
                      service_description   Redis Processes
                      check_command       check_nrpe!check_redis_procs
}
define service{
                      use   generic-service
                      host_name nagios_host
                      service_description  Redis Memory Usage
                      check_command      check_nrpe!check_redis_mem
}
define service{
                       use generic-service
                       host_name nagios_host
                       service_description  Redis Connected Clients
                       check_command     check_nrpe!check_redis_clients
}

Save and close the file.

Step 6 : Restart Services

Give permissions to created files and restart the nrpe and Nagios service.

  • chown -R nagios.nagioscmd redis-service-hosts.cfg
  • /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  • /etc/init.d/nagios-nrpe-server restart
  • /etc/init.d/nagios restart
redis-monitoring

If you’re facing any difficulties while configuring Redis service monitoring. Please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.


I recommended before implementing this article go through below articles which give you more understanding about Nagios Monitoring.

Related Posts :

Latest Comments
  1. Ramya April 5, 2017
  2. federico May 12, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *