REL (Remote Execution Layer) Addon
The Nagios REL
addon provides an alternative way to send service check
results from remote hosts back to nagios. It was developed
for scenarios where the customer's security policy does not
allow extra ports through the firewall for NRPE
orNSCA, which
both depend on TCP/IP connections. Currently, REL uses SMTP to
send the service check results to the Nagios server, but it can
easily be extended to use other protocols like nntp or ssh. The
image below shows how REL works.
Let's have a look on an example:
For this example we will setup a process check with our
check_process plugin (but you can use any other Nagios plugin as
well.) First of all, we need a service definition on our Nagios
server. We have defined a passive-check-template which can be
used for all passive service
checks. define service{
register 0 name passive-check-template
use generic-service
check_freshness 1
check_period none
passive_checks_enabled 1
max_check_attempts 1
check_command passive_check_missing
freshness_threshold 600
}
define service{
use passive-check-template
host_name webserver
service_description Syslog Process
contact_groups nagios,unix-admins
} We
do not disable active service checks. Instead we set the
check_period to 'none' (this avoids the cross in the CGIs,
indicating that there is something switched of). The
check_command will be called if there was no passive service check
result in the last 10 minutes (600 sec). The script looks like
this:#!/bin/sh
/bin/echo "CRITICAL: Passive Service check is missing!"
exit 2 Now
it's time to configure sendmail (qmail works as well). Just
add the following alias to your /etc/aliases file and recreate
the
database.nagiossmtp: "|/usr/bin/perl -w /usr/local/nagios/bin/smtpreceiver.pl" Make
sure, the sendmail user has write access to the nagios external
command file. That's it.
On the remote host, you will need to edit the relconfig file.
The HOST should match the host_name used in nagios. Protocol
defines which protocol to use (currently only SMTP). The DEST_MAIL
should match the alias we have just
defined. TARGET_HOST=127.0.0.1
HOST=webserver
protocol=SMTP
SENDMAIL_COMMAND=/usr/sbin/sendmail -oi -t -f SOURCE_MAIL -od
DEST_MAIL=nagiossmtp@my-nagios-host.com
SOURCE_MAIL=nagios@somewhat.com And
finally you have to create a cron entry that starts the plugin
every few minutes using the following command.# -c specifies the configuration file to use. if ommitted, then /etc/relconfig will be tried.
# -s specifies the Service to which this check will be associated
# next parameters are the plugin to execute and the plugin parameter.
./plugin_wrapper.pl -c $NAGIOSPATH/etc/relconfig -s "Syslog Process" $PLUGINPATH/check_process.pl -c /sbin/syslogd
|