Chapter 4. Configuring the remote node on the Nagios Core server
Configure the Nagios Core server to be aware of the remote nodes.
Prerequisites
- User-level access to the remote node on the Nagios Core server.
- Internet access.
Procedure
Install the
check_nrpe
plug-in:Copy to Clipboard Copied! Toggle word wrap Toggle overflow cd ~ wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.1.0/nrpe-3.1.0.tar.gz tar xvfz nrpe-3.1.0.tar.gz cd nrpe-3.1.0 ./configure make check_nrpe make install-plugin
[user@nagios]# cd ~ [user@nagios]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.1.0/nrpe-3.1.0.tar.gz [user@nagios]# tar xvfz nrpe-3.1.0.tar.gz [user@nagios]# cd nrpe-3.1.0 [user@nagios]# ./configure [user@nagios]# make check_nrpe [user@nagios]# make install-plugin
Create a configuration for the remote host:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cd /usr/local/nagios/etc/objects cp localhost.cfg mon.cfg
[user@nagios]# cd /usr/local/nagios/etc/objects [user@nagios]# cp localhost.cfg mon.cfg
Replace
localhost
with the hostname of the remote host, and the loopback IP address with the IP address of the remote host. Finally, delete or comment out the Host Group definition.Change the file ownership to Nagios:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow chown nagios:nagios mon.cfg
[user@nagios]# chown nagios:nagios mon.cfg
Add a
cfg_file=
reference to themon.cfg
file in/usr/local/nagios/etc/nagios.cfg
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow vi /usr/local/nagios/etc/nagios.cfg
[user@nagios]# vi /usr/local/nagios/etc/nagios.cfg
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cfg_file=/usr/local/nagios/etc/objects/mon.cfg
cfg_file=/usr/local/nagios/etc/objects/mon.cfg
Restart the Nagios server:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow systemctl restart nagios
[user@nagios]# systemctl restart nagios
Ensure that the make and install procedures worked and that there is connectivity between the Nagios Core server and the remote host containing NRPE:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/local/nagios/libexec/check_nrpe -H IP_ADDRESS_OF_REMOTE_HOST
[user@nagios]# /usr/local/nagios/libexec/check_nrpe -H IP_ADDRESS_OF_REMOTE_HOST
It should echo
NRPE v3.1.0-rc1
if it is working correctly.