NRPE is known as Remote Plugin Executor. The NRPE add-on is designed to execute plugins on remote Nix systems. In this NRPE daemon is installed on remote system to which services need to through nagios . NRPE runs as daemon on remote systems and wait for nagios requests. When nagios need to check status of any resources or applications to that remote host, sends and commands signal, which definition is stored on NRPE service. NRPE takes nagios request and execute command on local system and sends the result back to nagios.

This article will help you to install NRPE service on your system and add host in nagios for monitoring.

Step 1: Setup NRPE Service on Linux Host

1.1- Install NRPE

Firstly we would require to install nrpe service on remote Linux system, which we need to monitory through nagios server.

On /RHEL/Fedora

#  install nrpe nagios-plugins\*

On Debian//LinuxMint

# sudo apt-get install nagios-nrpe-server nagios-plugins

1.2- Configure NRPE

After successfully installing NRPE service, Edit nrpe configuration file (/etc/nagios/nrpe.cfg) in your favorite editor and add your nagios service in allowed hosts. For example your nagios server is 192.168.1.100.

#  /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1, 192.168.1.100

After making above changes in nrpe configuration file, Lets restart NRPE service as per your system

On CentOS/RHEL/Fedora 
# service nrpe restart

On Debian/Ubuntu/LinuxMint
$ sudo /etc/init.d/nagios-nrpe-server restart

1.3- Verify Connectivity from Nagios

Now make sure your nagios is able to connect nrpe client on remote Linux system. Login to your nagios server from command line and execute following command. For example your client system ip is 192.168.1.11

# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.11

NRPE v2.14

Step 2: Add Linux Host in Nagios

We recommend to use NagiosQL3 web interface for managing configuration of nagios server. Below steps is for CLI lovers. To add host in your nagios server from command line.

First create a configuration file /usr/local/nagios/etc/servers/MyLinuxHost001.cfg using below values. for example you Linux hosts ip is 192.168.1.11. We also need to define a service with host. So add a ping check service, which will continuously check that host is up or not.

# vim /usr/local/nagios/etc/servers/MyLinuxHost001.cfg
#########################################################
# Linux Host 001 configuration file
#########################################################

define host {
        use                          linux-server
        host_name                    Linux_Host_001
        alias                        Linux Host 001
        address                      192.168.1.11
        register                     1
}
define service{
      host_name                       Linux_Host_001
      service_description             PING
      check_command                   check_ping!100.0,20%!500.0,60%
      max_check_attempts              2
      check_interval                  2
      retry_interval                  2
      check_period                    24x7
      check_freshness                 1
      contact_groups                  admins
      notification_interval           2
      notification_period             24x7
      notifications_enabled           1
      register                        1
}


#########################################################
# END OF FILE
#########################################################

Now verify configuration files using following command. If there are no errors found in configuration, restart nagios service.

# nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios restart

Step 3: Check Host in Nagios Web Interface

Open your nagios web interface and check for new Linux hosts added in nagios core service. In my case it looks like below.

Nagios-Linux-host

Print Friendly

Comments

comments

Bài viết liên quan