Step by Step to Add Linux Host in Nagios Monitoring

What is NAGIOS:

                            Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

                      Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. With Nagios you’ll never be left having to explain why an unseen infrastructure outage hurt your organization’s bottom line


1) Install the below listed packages and their binaries & libraries with necessary dependencies:

[root@quickfixlinux ~]# yum install -y gcc glibc glibc-common gd make net-snmp 

Additionally, httpd and php will reuqired to install on the nagios monitoring server.


To Create the nagios user in the client Machine: 

 STEP 3: 

Extract the Nagios Plugin. Create a directory for nagios:

[root@quickfixlinux ~]# mkdir /root/nagios

[root@quickfixlinux ~]# cd /root/nagios

[root@quickfixlinux ~]# wget

STEP 4: 

After the download of nagios-plugin 2.1.4, need to extract it out:

[root@quickfixlinux ~]# tar xvf nagios-plugin-2.1.4.tar.gz


Compile and Install Nagios Plugin:

[root@quickfixlinux ~]#cd nagios-plugins-2.1.4

[root@quickfixlinux~]# ./configure –with-nagios-user=nagios –with-nagios-group=nagios

[root@quickfixlinux ~]# make

[root@quickfixlinux ~]# make install 


Set the permission for the compiled plugin directories:


Mostly, the xinetd package will be installed, if not try to install that package as well.

[root@quickfixlinux ~]# yum install xinetd 


NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with some of the Windows agent addons, so you can execute scripts and check metrics on remote Windows machines as well.

[root@quickfixlinux ~]# cd /root/nagios

[root@quickfixlinux ~]# wget


Extract the NRPE tar file now:

[root@quickfixlinux ~]# tar xvf 3.0.1.tar.gz


[root@quickfixlinux ~]# cd /root/nagios/nrpe-3.0.1

[root@quickfixlinux ~]# ./configure –with-nagios-user=nagios –with-nagios-group=nagios

[root@quickfixlinux ~]# make all

The installation should be successfully completed now.. So next…


Create a nrpe file under the path as /etc/xinetd.d/nrpe:

# default: off

# description: NRPE (Nagios Remote Plugin Executor)

service nrpe


flags           = REUSE

type            = UNLISTED

port            = 5666

socket_type     = stream

wait            = no

user            = nagios

group           = nagios

server          = /usr/local/nagios/bin/nrpe

server_args     = -c /etc/nagios/nrpe.cfg –inetd

log_on_failure  += USERID

disable         = no

only_from       =  space



STEP 10:

Next, you need to make an entry in the /etc/service file.. Before you edit take a backup of this file for safety consideration:

[root@quickfixlinux ~]# cp /etc/services /etc/services.31MAR17 

and add the below line at the file :

 nrpe            5666/tcp                 NRPE

Now, restart the xinetd service:

[root@quickfixlinux ~]# service xinetd restart

STEP 11:

To verify the nrpe service is running and responding in the client machine:

And to verify the nrpe daemon is listening as expected:

STEP 12:

To make changes in the nagios configuration file:

Open the path /usr/local/nagios/etc/nagios.cfg  [ Make a backup of this file before making changes].

Search for the word “allowed_hosts” = and replace with your server IP address

NOTE: Place your client IP address and Hostname in /etc/hosts as well as in Nagios monitoring server too.

Then, create a directory under /etc for nagios:

[root@quickfixlinux ~] # mkdir /etc/nagios

[root@quickfixlinux ~]# cp /usr/local/nagios/etc/nrpe.cfg /etc/nagios/


Once done, restart the xinetd service.. to verify the NRPE daemon service is working or not:

Now, the communication is working fine, which can be verified using the ip address loaded in the web browser.



Leave a Reply