How to install NRPE Nagios Client on Linux Easily

How to install NRPE Nagios Client on Linux

In this article, we describes you how to install NRPE Nagios Client on Linux. In the previous article, we have discussed about the installation of nagios server on Linux in the last article, click here to see how to configure and install the nagios on Linux servers.

If you are interested in learning, Request you to go through the below recommended tutorial.

This article will show you that, how to install Nagios NRPE client on Linux server.

How to install NRPE Nagios Client on Linux

Our Setup:

Server IP Address : 192.168.2.1
Client IP Address : 192.168.2.2 (Here only we are going to install nagios nrpe client)

1. Install Required Dependencies Packages

Please install all below required dependencies for Nagios through yum server, because installing these packages individually is more complicated. So we recommended to go with Yum server.

yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel

2. Download Nagios Client (NRPE) Software and Nagios Plugins


If you wish to download the latest version, please visit https://www.nagios.org/download/

I have downloaded from the below link and kept in my linux client already in the folder /home/learnitguide.

Nagios NRPE : http://sourceforge.net/projects/nagios/files/nrpe-2.x/
Nagios Plugin Link : http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz

[[email protected] ~]# cd /home/learnitguide/
Extract Nagios Core and its Plugins:
[[email protected] ~]# tar -xvf nrpe-2.15.tar.gz
[[email protected] ~]# tar -xvf nagios-plugins-2.0.3.tar.gz

3. Create a dedicated user and group for nagios

[[email protected] ~]# groupadd nagios
[[email protected] ~]# useradd -g nagios -d /home/nagios nagios
Set the password for Nagios user:
[[email protected] ~]# passwd nagios
Changing password for user nagios.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

4. Install the Nagios Plugin:

Go to the directory of nagios plugin which we extracted recently and start installing it.

[[email protected] ~]# cd nagios-plugins-2.0.3
[[email protected] nagios-plugins-2.0.3]# ./configure
[[email protected] nagios-plugins-2.0.3]# make
[[email protected] nagios-plugins-2.0.3]# make install

5. Change the ownership of the Nagios directories to the Nagios group & Nagios user.

[[email protected] nagios-plugins-2.0.3]# chown -R nagios:nagios /usr/local/nagios

6. Install the NRPE Nagios Client:

Go to the directory of nrpe nagios plugin which we extracted recently and start installing it.

[[email protected] nagios-plugins-2.0.3]# cd /root/nrpe-2.15
[[email protected] nrpe-2.15] ./configure
[[email protected] nrpe-2.15] make all
[[email protected] nrpe-2.15] make install-plugin
[[email protected] nrpe-2.15] make install-daemon
[[email protected] nrpe-2.15] make install-daemon-config
[[email protected] nrpe-2.15] make install-xinetd

7. Edit the /etc/xinetd.d/nrpe file to work through xinetd and add the nagios server IP address to allow requests.

Before Change:

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags           = REUSE
socket_type     = stream
port            = 5666
wait            = no
user            = nagios
group           = nagios
server          = /usr/local/nagios/bin/nrpe
server_args     = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure  += USERID
disable         = no
only_from       = 127.0.0.1
}

After change:

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags           = REUSE
socket_type     = stream
port            = 5666
wait            = no
user            = nagios
group           = nagios
server          = /usr/local/nagios/bin/nrpe
server_args     = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure  += USERID
disable         = no
only_from       = 127.0.0.1 192.168.2.1
}

8. Edit the /etc/services file and add nrpe to the services at the end of the line.

nrpe 5666/tcp # NRPE

9. Restart the xinetd service and check if the nrpe is being listened.

[[email protected] nrpe-2.15] /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[[email protected] nrpe-2.15] netstat -at | grep nrpe
tcp        0      0 *:nrpe                      *:*                         LISTEN
[[email protected] nrpe-2.15] /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15

If you get the NRPE Version as output here, you have done the NRPE installation on Linux successfully.

10. Ensure the connectivity between the Nagios client and the Nagios server:

Login into Nagios server 192.168.2.1 and run the below command, here we should get the nrpe version of the client.

[[email protected] ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.2.2
NRPE v2.15

We are done the installation of NRPE client, we will see the NRPE Configuration on Linux in other upcoming article.

Related Content on Linux might be useful to you to improve your Linux Skills.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.