Red Hat Training

A Red Hat training course is available for Red Hat Ceph Storage

Chapter 3. Installing Nagios Remote Plug-in Executor (NRPE)

To monitor Ceph Storage cluster hosts, install Nagios Plug-ins, the Ceph plug-ins and the NRPE add-on to each of the Ceph cluster’s hosts.

For demonstration purposes, this section adds NRPE to a Ceph monitor node with the hostname mon. Repeat the remaining procedures on all Ceph nodes that Nagios should monitor.

3.1. Install Prerequisites

NRPE requires OpenSSL. Install the following libraries first.

Execute the following:

[user@host]# yum install openssl openssl-devel gcc make git
[user@host]# apt install openssl libssl-dev gcc make git

3.2. Create a Nagios User

NRPE installation requires a Nagios user. So create the user first.

[user@mon]# useradd nagios
[user@mon]# passwd nagios

3.3. Download, Make and Install the Nagios Plug-ins

Download the latest version of the Nagios plug-ins. Then, make and install them.

[user@mon]# wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
[user@mon]# tar zxf nagios-plugins-2.2.1.tar.gz
[user@mon]# cd nagios-plugins-2.2.1
[user@mon]# ./configure
[user@mon]# make
[user@mon]# make install

3.4. Download, Make and Install the Nagios Ceph Plug-ins

Download the latest verion of the Ceph plug-ins. See https://github.com/valerytschopp/ceph-nagios-plugins for details.

[user@mon]# cd ~
[user@mon]# git clone --recursive https://github.com/valerytschopp/ceph-nagios-plugins.git
[user@mon]# cd ceph-nagios-plugins
[user@mon]# make dist
[user@mon]# make install

3.5. Install xinetd

NRPE uses xinetd for communication. Install it before installing the NRPE module. Execute the following:

[user@mon]# yum install xinetd
[user@mon]# apt install xinetd

3.6. Download, Make and Install Nagios NRPE

[user@mon]# cd ~
[user@mon]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.1.0/nrpe-3.1.0.tar.gz
[user@mon]# tar xvfz nrpe-3.1.0.tar.gz
[user@mon]# cd nrpe-3.1.0
[user@mon]# ./configure
[user@mon]# make all
[user@mon]# make install-groups-users
[user@mon]# make install
[user@mon]# make install-config
[user@mon]# make install-init

Then, add nrpe 5666/tcp to the /etc/services file.

3.7. Enable, Restart and Reload xinetd.

[user@mon]# systemctl enable xinetd
[user@mon]# systemctl restart xinetd
[user@mon]# systemctl reload xinetd

3.8. Enable and Start NRPE

[user@mon]# systemctl enable nrpe
[user@mon]# systemctl start nrpe

3.9. Open Port 5666

Open port 5666 to allow communication with NRPE.

[user@mon]# firewall-cmd --zone=public --add-port=5666/tcp
[user@mon]# firewall-cmd --zone=public --add-port=5666/tcp --permanent
[user@mon]# iptables -A INPUT -p tcp --dport 5666 -j ACCEPT
[user@mon]# apt-get install iptables-persistent

3.10. Add the Nagios Core Server IP Address

In order for the Nagios Core server to access NRPE on a remote machine, the remote machine’s xinetd and NRPE configurations must be updated with the IP address of the Nagios Core server.

Edit the xinetd configuration with the Nagios server’s IP address.

[user@mon]# vim /etc/xinetd.d/nrpe
# default: off
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
    disable         = yes
    socket_type     = stream
    port            = 5666
    wait            = no
    user            = nagios
    group           = nagios
    server          = /usr/local/nagios/bin/nrpe
    server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
    only_from       = 127.0.0.1,<ip-address-of-nagios-core>
    log_on_success  =
}

Add the IP address of the Nagios Core server to the only_from setting. Then, restart xinetd.

[user@mon]# systemctl restart xinetd

Edit the NRPE configuration with the Nagios server’s IP address.

[user@mon]# vim /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,<ip-address-of-nagios-core>

Add the IP address of the Nagios Core server to the allowed_hosts setting. Then, restart nrpe.

[user@mon]# systemctl restart nrpe

3.11. Test the Installation

Ensure that the make and install procedures worked.

[user@host]# /usr/local/nagios/libexec/check_nrpe -H localhost

The check should echo NRPE v3.1.0-rc1 if it is working correctly.