Nagios NRPE

From SME Server
Jump to navigationJump to search


Edit-find-replace.png Not reviewed:
This howto or contrib has not been reviewed and might contain code that could harm your installation. For more information on the review process have a look at the Development Review page.


Maintainer

Michael Weinberger


Introduction

This Document describes the installation of the Nagios Remote Plugin Executer (NRPE) installation on a SME server to be monitored by a Nagios server.

Download

Download the packages and files from http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/Nagios3/packages/ manually or run the the script wgetall to download all in one go.

bash < wgetall

Installation

Configure the dag repositoy

You need to activate the Dag reposity before installing this contrib.

see dag repository

NRPE installation

/usr/bin/yum --enablerepo=dag install \
 nagios-plugins \
 nagios-plugins-setuid \
 perl-Config-Tiny \
 perl-Class-Accessor
/usr/bin/yum --enablerepo=dag localinstall \
 smeserver-nagios-nrpe-*.noarch.rpm \
 smeserver-nagios-backup-*.noarch.rpm \
 perl-Nagios-Plugin-*.noarch.rpm \
 smeserver-nagios-plugins-mysql-*.noarch.rpm \
 nagios-plugins-generic-*.noarch.rpm  \
 nagios-of-plugins-*.noarch.rpm


NRPE configuration

Create a the NRPE configuration file /etc/nagios/nrpe.cfg. Use the nrpe.cfg provided by this conrib as a starting point. Add the IP address of your central Nagios server to the variable allowed_hosts. Use the local IP of the central Nagios server if you check the server over the local network or over a VPN, otherwise use the WAN IP.


Allow the central Nagios server to access the NRPE service

Add the IP address of the your central Nagios to Local Networks in the server-manager.

Configure the TCP wrapper. This is required for SSL connections to the NRPE.

config set nrpe service
config setprop nrpe HostsAllow "127.0.0.1 NAGIOS_CENTRAL_SERVER_IP"
expand-template /etc/hosts.allow
Allow the Nagios plugins to be executed as root (optional)

A few plugins only work when they are executed as root. This configures the sudoers configuration.

config setprop nrpe sudoPlugins yes
expand-template /etc/sudoers

Start the service

service nrpe restart


If the NRPE SME server is behind a firewall, you must forward port 5666/tcp to the server.
Test the installation by running this command on the central Nagios server:

/usr/lib/nagios/plugins/check_nrpe -H IPADDRESS

or if you have a 64 bit architecture

/usr/lib64/nagios/plugins/check_nrpe -H IPADDRESS

Expected result:

NRPE v2.5.1
SSL issue

You may get the following error :

CHECK_NRPE: Error - Could not complete SSL handshake.

Edit /etc/nagios/nrpe.cfg and add your Nagios server IP

e.g. (beware spaces)

allowed_hosts=127.0.0.1,192.168.1.1,192.168.99/24

Koozali v9

I used this as a guide when installing nrpe on v9. I had to do a few extra steps as follows:

Add the EPEL repo https://wiki.contribs.org/Epel

yum --enablerepo=epel install nrpe

Create new template:

mcedit /etc/e-smith/templates/etc/hosts.allow/nrpe

Add the following and save:

{
    $DB->hosts_allow_spec('nrpe');
}

Create the DB entry:

config set nrpe service HostsAllow "127.0.0.1 NAGIOS_CENTRAL_SERVER_IP" status enabled

Expand the template:

expand-template /etc/hosts.allow

Add your Nagios server IP to /etc/nagios/nrpe.cfg as above.

/etc/rc.d/init.d/nrpe restart

Make a softlink:

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S92nrpe

Upgrade/reboot:

signal-event post-upgrade;signal-event reboot

Uninstall

This removes the installed Nagios packages.

service nrpe stop
rpm -e \
 nagios \
 smeserver-nagios-nrpe \
 smeserver-nagios-backup \
 nagios-plugins-nrpe \
 nagios-of-plugins \
 nagios-plugins-generic \
 nagios-plugins-setuid \
 nagios-plugins-temptrax \
 perl-Nagios-Plugin \
 smeserver-nagios-plugins-mysql