Thursday, 7 January 2016

Nagios Client installation in linux server

NAGIOS Client Installation


1. Login with root user.
$ sudo -i

2. Create user account with nagiso and setup password for user.
# useradd nagios
# passwd nagios

3. Download and Install the Nagios Plugins.
yum install gcc glibc glibc-common gd gd-devel net-snmp openssl-devel make
4 .Extract the Nagios plugins source code.
Move in to the directory.

Compile and install the plugins.

# ./configure
# make
# 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

5.Install xinetd service.

# yum install xinetd

6.Now Install the NRPE daemon.

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

# wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

7.Extract the NRPE source code.

# tar -xf xxx.tar.gz

Now Move in to extracted directory.

# cd xxx

8.Compile the NRPE addon.

# ./configure
# make all

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

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

# only_from= 127.0.0.1 <nagios_ip_address>

10. Add the following entry for the NRPE daemon to the /etc/services file.
nrpe 5666/tcp # NRPE

11. Restart the xinetd service.

# service xinetd restart

12.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 it does, great!

13. Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.

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

You should get a string back that tells you what version of NRPE is installed, like this:

NRPE v2.8x