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
[root@nagios ~]# cd ~ [root@nagios ~]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.3/nrpe-4.0.3.tar.gz [root@nagios ~]# tar xvfz nrpe-4.0.3.tar.gz [root@nagios ~]# cd nrpe-4.0.3 [root@nagios nrpe-4.0.3]# ./configure [root@nagios nrpe-4.0.3]# make check_nrpe [root@nagios nrpe-4.0.3]# make install-pluginCreate a configuration for the remote host:
Syntax
cd /usr/local/nagios/etc/objects cp localhost.cfg HOST_TO_ADD.cfgExample
[root@nagios nrpe-4.0.3]# cd /usr/local/nagios/etc/objects [root@nagios objects]# cp localhost.cfg host01.cfgEdit the configuration file and update the settings for the remote host:
Syntax
vi HOST_TO_ADD.cfgExample
[root@nagios objects]# vi host01.cfgSyntax
# Define a host for the local machine define host { use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name LOCALHOST alias LOCALHOST address 127.0.0.1 }Replace LOCALHOST with the hostname of the remote host, and
127.0.0.1with the IP address of the Ceph monitor host.Example
# Define a host for the local machine define host { use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name host01 alias host01 address 10.10.128.69 }Delete or comment out the Host Group definition:
Example
[root@nagios objects]# vi host01.cfg#define hostgroup { # # hostgroup_name linux-servers ; The name of the hostgroup # alias Linux Servers ; Long name of the group # members localhost ; Comma separated list of hosts that belong to this group #}Change the file ownership to Nagios:
Example
[root@nagios objects]# chown nagios:nagios host01.cfgAdd a
cfg_file=reference to thehost01.cfgfile in/usr/local/nagios/etc/nagios.cfg:Example
[root@nagios objects]# vi /usr/local/nagios/etc/nagios.cfgcfg_file=/usr/local/nagios/etc/objects/host01.cfgRestart the Nagios server:
Example
[root@nagios objects]# systemctl restart nagiosEnsure 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_HOSTReplace HOSTNAME_OF_REMOTE_HOST with the IP address of the Ceph host to monitor.
Example
[root@nagios objects]# /usr/local/nagios/libexec/check_nrpe -H host01
Verification
-
The check should echo
NRPE v4.0.3if it is working correctly.