Nagios: How to Check if Remote Process or Services Is Running on Linux Machine


In this article, we configure how to add a service to monitoring on Linux Clients for demonstration purpose we are monitoring MySQL services. Basically, you only need to install NRPE to monitor services, processes, disk space, load, etc on your remote machine.  For how to install the NRPE plugin, please click here

For my demo,  I only need to check if a MySQL process is running and will use the check_procs. 
NRPE and Nagios Plugins were installed and I can check the Nginx process locally using the following commands:

# /usr/local/nagios/libexec/check_procs -c 1:30 -C mysqld


wherein: -c 1:30 <– refers to the Critical range for the number of MySQL processes are running.
If their process count is below 1 and above 30 this will send me a Critical notice. 
If you want to add a Warning level you can use “-w 1:25” - adjust the number of processes for your needs. -C mysqld <– this will check for the command name (mysqld)

NOTE: For a complete reference on this check and other samples please refer to the NagiosWiki page.

Below are is the configurations:

On Client Side

# vi /usr/share/nagios/etc/nagios.cfg

add the following command in the configuration file below this lines

# The following examples use hardcoded command arguments...
.
.
.
.
.
.
command[check_mysql]=/usr/local/nagios/libexec/check_procs -c 1:30 -C mysqld


Nagios server


Open the service configuration files and add the following at the end of the file.

# vi /usr/local/nagios/etc/services.cfg
define service{
            use                       generic-service        
           host_name                  mydbserver
           service_description        MySQL Status
           check_command              check_nrpe!check_mysql

     }


Keywords: Services, Nagios, Monitoring Remoter services, Remote services, Running status, Status of Services

Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Upgrade PV Drivers on Windows Instances

How to configure Incremental backups for MSSQL Database