Configuring server host to respond to nagios host (monitor remote services) – CentOS

Download nagios plugin and nagios-nrpe plugin in the server host (client that talks with nagios host) from nagios website. The files comes as .tar files and you need to configure them for their use. Move the files to /usr/src

$ cd /usr/src
$ tar zxvf nagios-plugins-1.4.13.tar.gz
$ cd nagios-plugins-1.4.13

$ ./configure –prefix=/usr/local/nagios
$ make
$ make install

Now nagios-plugin is successfully installed. Go back to /usr/src

$ cd ..
$ tar zxvf nrpe-2.12.tar.gz
$ cd nrpe-2.12
$ ./configure –enable-ssl

By default, you will get the following list of information. If you want to change these values you can go ahead and change them.

General Options:
————————-
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios

$ make all

If the nrpe client compiled without any error then you can continue with installation settings to make these two comptuers talk to each other.

$ make install-plugin
$ make install-daemon
$ make install-daemon-config
$ make install-xinetd

$ cp src/nrpe /usr/local/nagios/libexec/
$ cp src/check_nrpe /usr/local/nagios/libexec/

Now the executables are in place and we can configure the NRPE daemon on the remote system.

Search for the string “allowed_hosts” in /etc/nagios/nrpe.cfg and change it to the nagios host IP address (this restricts the server host to listen only from the above IP)

# Set this to listen only from nagios host
allowed_hosts=127.0.0.1

Restart nagio nrpe in ubuntu

* Identify where nrpe.cfg and make the necessary changes to that configuration file. Save it. Then restart the nrpe server by
$ /etc/init.d/nagios-nrpe-server restart

From centos, if you want to start xinetd
$ /etc/init.d/xinetd restart

From the server host execute telnet to see if you can communicate with nagios host

telnet remote-nagios-host 5666

If you get the following message then everything sounds fine until now

Escape character is ‘^]’.

FROM NAGIOS HOST

Add the following entries in developer-host.cfg (the name of the file is configurable from nagios.cfg file)

define host{
use linux-server ; Name of host template to use
host_name developer-host
alias developer-host
normal_check_interval 2
retry_check_interval 1
address 10.4.8.48
}

define service{
use generic-service
host_name developer-host
service_description HTTP
check_command check_http
notifications_enabled 1
normal_check_interval 2
retry_check_interval 1
}

Restart nagios from nagios host and you are ready to go.

Note: If you have custom commands that you need to run or configure certain perl files, then you can add the entry for the command in nagios.cfg and about the execution entry

in the custom defined .cfg file for that host. This custom defined entry needs to be configured in the nrpe.cfg file that is to be located in the server host (client listening to nagios host)

For configuring the nagios nrpe host, client on Ubuntu check the following resources

http://sysbible.org/x/2008/11/10/how-to-install-nagios-nrpe-under-debian-linux/

http://debianclusters.cs.uni.edu/index.php/Nagios_NRPE_Addon_Installation_and_Configuration