Jump to content

Photo - - - - -

Installing Nagios on RHEL 5

Posted by konstantine , 20 March 2012 · 3,337 views

Hey Fellas,

Here is and add-on Tutorial On How-To add hosts to nagios server.

To start , In the remote host add nagios user :

/usr/sbin/useradd nagios passwd nagios
We need two packages .

Nagios-plugin and Nrpe (download the latst version from the nagios web site)

Compile and install the plugins. (1.4.13)

make install

The permissions on the plugin directory and the plugins will need to be fixed at this point, so run the following commands.

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
Install XINETD .



yum Install xinetd

In other Linux distro please use : apt-get (UBUNTU/DEBIAN) or zypper (OPENSUSE) or your slackware download manager .

Install the NRPE daemon

Download the source code tarball of the NRPE addon (visit http://www.nagios.org/download/ for links to the latest


cd ~/downloads
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

Extract the NRPE source code tarball.

tar xzf nrpe-2.12.tar.gz
cd nrpe-2.12

Compile the NRPE addon.


Install the NRPE plugin (for testing), daemon, and sample daemon config file.

make install-plugin
make install-daemon
make install-daemon-config

Install the NRPE daemon as a service under xinetd.

make install-xinetd

Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.

only_from =

Add the following entry for the NRPE daemon to the /etc/services file.

nrpe 5666/tcp # NRPE

Restart the xinetd service.

service xinetd restart

Test the NRPE daemon locally

Its time to see if things are working properly...

Make sure the nrpe daemon is running under xinetd.

netstat -at | grep nrpe

The output out this command should show something like this:

tcp 0 0 *:nrpe *:* LISTEN

if you are using the IPtables, add this line :

iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT

Save the new iptables rule so it will survive machine reboots.

service iptables save

NRPE commands

You can test some of these

by running the following commands:

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_hda1

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs

Now back to your Nagios Server , and Install NRPE deamon :

Download nrpe and extract.

make all

Install the NRPE plugin

make install-plugin

check of nrpe is working we will check the nrpe in the remote host :

[[email protected] nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H

NRPE v2.12

Now in the nagios server :

Go to

Cd /usr/local/nagios/etc/objects
Cp linux-server.cfg linux-remotemachine.cfg

Open linux-remotemachine.cfg and edit the hostname and IP adress

Save exit

Cd /usr/local/nagios/etc

vi nagios.cfg

Add this line :

# Definitions for monitoring the local (Linux) host




save and exit

hehehe Almost done :D !! whats next??? :

Let us check if you nagios server nagios can start without errors

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Any questions??? Shoot them :D


Konstantine Gorshkov

Source: Installing Nagios on RHEL 5

How to add host for monitoring , I have 20 windows client and 40 Linux Cleints and Some server in linux. please help ...

August 2019

1819 20 21222324

Recent Comments


    Search My Blog




    Test Providers

    Site Info

    Go to top