How to remote monitor cPanel with Nagios via installing NRPE

Using a Nagios plug-in called NRPE to monitor the health of a server in conjunction with external checking (aka checking for open ports) gives a little more in-depth check. It can also allow you to catch some problems before they result in a service being unavailable.

Firstly make sure you have opened the NRPE port on your firewall 5666 tcp.

Install

nagios-plugin installation

cd /usr/src/
/usr/sbin/useradd nagios
passwd nagios
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar -xvzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure
make
make install
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec

Make sure that xinetd has installed on the server. Else install using :

yum install xinetd

Check for Openssl-devel

this should should give a result.

rpm -qa | grep openssl-devel

If you dont please install via yum

yum install openssl*

nrpe daemon installation

cd /usr/src/
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
tar -xvzf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd

edit /etc/xinetd.d/nrpe Change the IP at the “only_from” option. To the IP of the server that will monitor it. Should end up looking like this:

default: on
description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
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
log_on_failure += USERID
disable = no
only_from = 11.11.11.11
}

echo "nrpe 5666/tcp # Nagios Plugin NRPE" >> /etc/services
chkconfig xinetd on
service xinetd restart

That is all that should be needed for the default setup of NRPE checks. The default checks should be found in /usr/local/nagios/etc/nrpe.cfg

To test if this is working from your monitoring nagios server run one of the following (depending where check_nrpe was installed to)

/usr/lib/nagios/plugins/check_nrpe -H ip_of_cPanel_server
/usr/local/nagios/libexec/check_nrpe -H ip_of_cPanel_server
/usr/lib64/nagios/plugins/check_nrpe -H ip_of_cPanel_server

And all going well should end up with a responce like this
NRPE v2.12
Was this article helpful?
Cancel
Thank you!