Monitor Memcache Service with Nagios

Monitor Memcached Service with Nagios

In this article, we are going to monitor Memcached 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.

Memcached 

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


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

  • Total-free-memory
  • Current_items
  • Current_connections
  • Total_connections
  • Limit_maxbytes

Configuration of Memcache Custom Plugin 

Step 1 : Install Dependency package

To run custom plugin of Memcache you need to first install dependency package on the server which supports Memcached plugin.

Run below command to install package,

  • apt-get install libcache-memcached-perl

Step 2 : Download Memcache custom Plugin

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

Step 3 : Permissions

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

  • chmod +x check_memcached.pl

Step 4 : Configure Memcache plugin

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

vim /etc/nagios/nrpe.cfg

command[check_memcached]=/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip -p 11211 -t ping


command[check_memcached_threads]=/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --threads=WARN:5,CRIT:8

Save and close file.

You can also use below parameters for monitoring use threshold values of warning and critical as per your requirement.

/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --total_free=WARN:value,CRIT:value
/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --curr_items=WARN:value,CRIT:value
/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --total_connections=WARN:value,CRIT:value
/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --curr_connections=WARN:value,CRIT:value
/usr/local/nagios/libexec/check_memcached.pl -H memcached-ip --limit_maxbytes=WARN:value,CRIT:value

Note : To check some other parameters with their threshold values use below help command.

  • /usr/local/nagios/libexec/check_memcached.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 memcached-service-hosts.cfg

vim /usr/local/nagios/etc/clients/memcached-service-hosts.cfg

define service{
                      use   generic-service
                      host_name   nagios_host
                      service_description   Redis Processes
                      check_command   check_nrpe!check_memcached
}
define service{
                       use   generic-service
                       host_name   nagios_host
                       service_description   Redis Memory Usage
                       check_command   check_nrpe!check_memcached_threads
}

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 memcached-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
Memcached Monitoring

If you’re facing any difficulties while configuring Memcached 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 :

Leave a Reply

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