Nagios NRPE on SME server

Scenario / Question:

How do I install NRPE on a SME 7 server

Solution / Answer:

You install NRPE by using the rpm packages hosted by Michael Weinberger.

Download rpm packages

Use the following script to automatically download all the needed packages

wget_nrpesme

Download and Run:

# mkdir -p /opt/Nagios/Nagios_NRPE/

# cd /opt/Nagios/Nagios_NRPE/

# wget http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/Nagios3/packages/wgetall

# chmod 744 wgetall

# ./wgetall

Configure Dag Repository for nagios-plugins

Issue the following command on the command line:

/sbin/e-smith/db yum_repositories set dag repository \
Name 'Dag - EL4' \
BaseURL 'http://apt.sw.be/redhat/el4/en/$basearch/dag' \
EnableGroups no \
GPGCheck yes \
GPGKey http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt \
Visible no \
Exclude freetype,htop,iptraf,rsync,syslinux \
status disabled

Update changes to the Yum configuration file:

# signal-event yum-modify

Install NRPE

Install the nagios-plugins packages via yum repo Dag:

/usr/bin/yum --enablerepo=dag install \
 nagios-plugins \
 nagios-plugins-setuid \
 perl-Config-Tiny \
 perl-Class-Accessor

Install the dowloaded rpm packages from wgetall via yum localinstall

/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

Configure nrpe service:

# config set nrpe service

Configure Hosts Allow ( Add the IP or Reverse DNS capable domain name of the Nagios monitoring server ):

# config setprop nrpe HostsAllow "127.0.0.1 NAGIOS_SERVER_IP"
# expand-template /etc/hosts.allow

Give Nagios Plugins sudo execution (root execution):

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

Start NRPE Service:

# service nrpe restart

Test NRPE is working:

# /usr/lib/nagios/plugins/check_nrpe -H localhost

NRPE Firewall Settings

If your Nagios server is not on your local network then you need to configure your SME firewall to allow the Nagios server to access NRPE.

https://localhost/server-manager

portforwarding > create portforwarding rule

Protocol    [TCP]
Source Port(s)    5666
Destination Host IP Address    localhost
Destination Port(s)    5666

NRPE Configuration for Remote Access

Even though we opened up ports in our Firewall and NRPE is working via localhost we still need to configure nrpe.cfg to allow our remote Nagios server to connect.

Copy nrpe.cfg file we downloaded with wgetall script and replace the default nrpe.cfg in /etc/nrpe.cfg:

# cp /opt/Nagios/Nagios_NRPE/nrpe.cfg /etc/nagios/

Edit /etc/nagios/nrpe.cfg and change the line “allowed_hosts 127.0.0.1,put_central_nagios_server_ip_here” and replace “put_central_nagios_server_ip_here” to your nagios servers ip.

# vi /etc/nagios/nrpe.cfg

No Comments

Leave a reply