Chapter 4. Configuring the remote node on the Nagios Core server
Configure the Nagios Core server to be aware of the remote hosts.
Prerequisites
- Root-level access to the remote node on the Nagios Core server.
- Internet access.
Procedure
Install the
check_nrpeplug-in:Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a configuration for the remote host:
Syntax
cd /usr/local/nagios/etc/objects cp localhost.cfg HOST_TO_ADD.cfg
cd /usr/local/nagios/etc/objects cp localhost.cfg HOST_TO_ADD.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
[root@nagios nrpe-4.0.3]# cd /usr/local/nagios/etc/objects cp localhost.cfg host01.cfg
[root@nagios nrpe-4.0.3]# cd /usr/local/nagios/etc/objects [root@nagios objects]# cp localhost.cfg host01.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the configuration file and update the settings for the remote host:
Syntax
vi HOST_TO_ADD.cfg
vi HOST_TO_ADD.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
vi host01.cfg
[root@nagios objects]# vi host01.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace LOCALHOST with the hostname of the remote host, and
127.0.0.1with the IP address of the Ceph monitor host.Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete or comment out the Host Group definition:
Example
vi host01.cfg
[root@nagios objects]# vi host01.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the file ownership to Nagios:
Example
chown nagios:nagios host01.cfg
[root@nagios objects]# chown nagios:nagios host01.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add a
cfg_file=reference to thehost01.cfgfile in/usr/local/nagios/etc/nagios.cfg:Example
vi /usr/local/nagios/etc/nagios.cfg
[root@nagios objects]# vi /usr/local/nagios/etc/nagios.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow cfg_file=/usr/local/nagios/etc/objects/host01.cfg
cfg_file=/usr/local/nagios/etc/objects/host01.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the Nagios server:
Example
systemctl restart nagios
[root@nagios objects]# systemctl restart nagiosCopy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that the make and install procedures worked and that there is connectivity between the Nagios Core server and the remote host containing NRPE:
Syntax
/usr/local/nagios/libexec/check_nrpe -H HOSTNAME_OF_REMOTE_HOST
/usr/local/nagios/libexec/check_nrpe -H HOSTNAME_OF_REMOTE_HOSTCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace HOSTNAME_OF_REMOTE_HOST with the IP address of the Ceph host to monitor.
Example
/usr/local/nagios/libexec/check_nrpe -H host01
[root@nagios objects]# /usr/local/nagios/libexec/check_nrpe -H host01Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
The check should echo
NRPE v4.0.3if it is working correctly.