image

NRPE setup on Nagios Server and Remote Host
############################################
On Nagios Server
——————–
Install NRPE

Downlaod nrpe-2.12.tar.gz from nagios.org

# tar xvfz nrpe-2.12.tar.gz
# cd nrpe-2.12

# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd

Setup NRPE to run as daemon (i.e as part of xinetd):
• Modify the

# vi /etc/xinetd.d/nrpe

to add the ip-address of the Nagios monitoring server to the only_from directive.
Note that there is a space after the 127.0.0.1 and the nagios monitoring server ip-address
(in this example, nagios monitoring server ip-address is: 192.168.1.2)

only_from       = 127.0.0.1 192.168.1.0/24

• Modify the /etc/services and add the following at the end of the file.

nrpe 5666/tcp # NRPE

• Start the service

#service xinetd restart

• Verify whether NRPE is listening

netstat -at | grep nrpe or lsof -i :5666

tcp 0      0 *:nrpe *:*                         LISTEN

• Verify to make sure the NRPE is functioning properly

#/usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12

Configuration steps on the Nagios monitoring server to monitor remote host
—————————————————————————
On Nagios Server
——————–
Install NRPE on monitoring host

Downlaod nrpe-2.12.tar.gz from nagios.org

# tar xvfz nrpe-2.12.tar.gz
# cd nrpe-2.12

# ./configure

Note: I got the “checking for SSL headers… configure: error: Cannot find ssl headers” error message while performing ./configure. Install openssl-devel as shown below and run the ./configure again to fix the problem.

To resolve the error Install openssl-devel package

Dependencies of Packages:-

libsepol-devel-1.15.2-2.el5.i386.rpm
libselinux-devel-1.33.4-5.5.el5.i386.rpm
keyutils-libs-devel-1.2-1.el5.i386.rpm
e2fsprogs-devel-1.39-23.el5.i386.rpm
krb5-devel-1.6.1-36.el5.i386.rpm
openssl-devel-0.9.8e-12.el5.i386.rpm

# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd

Setup NRPE to run as daemon (i.e as part of xinetd):
• Modify the

# vi /etc/xinetd.d/nrpe

to add the ip-address of the Nagios monitoring server to the only_from directive.
Note that there is a space after the 127.0.0.1 and the nagios monitoring server ip-address
(in this example, nagios monitoring server ip-address is: 192.168.1.2)

only_from       = 127.0.0.1 <nagios server IP >

• Modify the /etc/services and add the following at the end of the file.

nrpe 5666/tcp # NRPE

• Start the service

#service xinetd restart

• Verify whether NRPE is listening

netstat -at | grep nrpe or lsof -i :5666

tcp 0      0 *:nrpe *:*                         LISTEN

– Done

Test
• Verify to make sure the NRPE is functioning properly
from the Nagios server

#/usr/local/nagios/libexec/check_nrpe -H <IP of remote Server >

———————————————————————
Create host and service definition for remotehost
————————————————–
Create a new configuration file /usr/local/nagios/etc/objects/remotehost.cfg to define the host and service definition for this particular remotehost. It is good to take the localhost.cfg and copy it as remotehost.cfg and start modifying it according to your needs.

define host{
use                     linux-server            ; Name of host template to use
host_name               feenix_org
alias                   feenix_or
address                 192.168.0.12
}

define service{
use                             generic-service         ; Name of service template to use
host_name                       feenix_org
service_description             PING
check_command                   check_nrpe!check_disk
}

Now restart Nagios service
# service nagios restart

Note;- Checking services…
Error: Service check command ‘check_nrpe’ specified in service ‘PING’ for host ‘feenix_org’ not defined anywhere!

need to add command in
vi ../etc/objects/commands.cfg

#####################################
#   NRPE
###################################

# ‘check_nrpe’ command definition
define command{
command_name    check_nrpe
command_line    /usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}

Now restart nagios service

Leave a Reply