How to run nrpe daemon ?

Ralph.Grothe at itdz-berlin.de Ralph.Grothe at itdz-berlin.de
Wed Aug 10 10:14:55 CEST 2005


Hi Chris,

I'm also new to Nagios, so probably not being the right person to
advise you.

However, I've only recently set up my Nagios server (and still am
fumbling with its configuration),
and Nagios managed hosts of which some have an NRPE daemon
running.


What needs to be done is lined out (tersely) in the README of the
NRPE source tarball,
and even after you have run "make all" (or even "make install"
errenously)
there is a screen displayed that says what next needs to be done
on the managed host
that runs the nrpe daemon, as well as in your Nagios server's
config.

What is your target OS?
(I could only help with Unix like since I'm not into Win32, MAC
etc.)


Basically, 

- Get the source tarball from Nagios Exchange
(if you don't need specific compile switches you could even
download pre-built binaries for your OS)

- Unpack into a staging directory

- change into the staging dir, and read the README, INSTALL, OS
specific addendums etc.

- run the configure script with --help, and study possible
options

- decide where you want nrpe reside (i.e. --prefix=), 
  what user and group the NRPE daemon should run as (i.e.
--with-nrpe-user=, --with-nrpe-group=),
  what port it should be listening on for connects from your
Nagios server (i.e. --with-nrpe-port=),
  if you wish the NRPE daemon to accept arguments
(--enable-cmd-args,  consider the security implications),
  if you require SSL/TLS connection (--enable-ssl), and on a few
other options --help would display

- run "make all", and read the final screen on success.

- copy the binary <stage_dir>/src/nrpe somewhere appropiate (e.g.
/usr/local/nagios/sbin)
  this is the NRPE daemon

- copy the file <stage_dir>/nrpe.cfg, that already got populated
with the values you passed to configure,
  into another appropiate place (e.g. /usr/local/nagios/etc)

- decide whether your NRPE daemon should be running stand-alone,
or run through (x)inetd

As I decided on the latter I then extended inetd's config by a
line like such


# tail -3 /etc/inetd.conf
#
# Nagios Remote Plug-In Executor
nrpe    stream tcp nowait nagios /usr/local/nagios/sbin/nrpe nrpe
-c /usr/local/nagios/etc/nrpe.cfg -i


Beware, if your OS is Linux chances are you are already running
inetd successor xinetd whose configuration
is slightly more involved (I think you usually will find its
config in /etc/xinetd.d or similar)

Send your inetd a SIGHUP

e.g.

on Linux either

# pkill -s HUP -P 1 -x xinetd

# service xinetd restart

On other Unices grep the PID from the process table

e.g.

on HP-UX I would do

# kill -1 $(UNIX95= ps -o pid= -C inetd)

or

# /usr/sbin/inetd -c

Then check your syslogd's logfile for facility daemon (usually,
if default was used, /var/log/messages,
/var/adm/syslog/syslog.log etc)
if inetd successfully reinitialized (sometimes it remained silent
if no extended logging was configured)

- Check for the new listening port (the one you specified in
--with-nrpe-port, per default 5666/tcp)

On most Unices

# netstat -an | grep LISTEN | grep \.5666

or on Linux

# lsof -i tcp:5666


- Now revisit nrpe.cfg and add or customize some check commands
you wish to be executed indirectly through NRPE.

- Then first check locally if nrpe daemon is executing the check

e.g. a mere filesystem free space check (<10% WARNING, <5%
CRITICAL) I defined like this


# grep ^command\\[check_disk_LOCPCT_W10C5
/usr/local/nagios/etc/nrpe.cfg
command[check_disk_LOCPCT_W10C5]=/usr/local/nagios/libexec/check_
disk -e -l -X cdfs -X nfs -x /cdrom -w 5% -c 2%

and run as

# su - nrpe_user -c "/usr/local/nagios/libexec/check_nrpe -H
127.0.0.1 -c check_disk_LOCPCT_W10C5"

DISK OK - free space:| /=185MB;190;196;0;200
/stand=87MB;110;113;0;116 /var=1082MB;1375;1419;0;1448 /v
ar/adm/crash=2496MB;3657;3773;0;3850 /usr=814MB;858;885;0;904
/tmp=120MB;190;196;0;200 /ora_save=757MB
;2850;2940;0;3000 /opt=709MB;731;754;0;770
/opt/gnu=267MB;288;297;0;304 /home=78MB;98;101;0;104 /app=8
969MB;9500;9800;0;10000 /vb=3418MB;6688;6899;0;7040
/zlb=1845MB;6688;6899;0;7040
logout


Fill up some unneeded filesystem to provoke a WARNING or CRITICAL
return code, and recheck.

- Finally do the same checks from your Nagios server over your
LAN.

However, before you can do this you need to build the binary
check_nrpe for the target OS of the host
that runs your Nagios server (but you know by now how this is
done)

Then define a service in your Nagios server's services.cfg (and
if needed a check command definition for check_nrpe)


That's usually all that is required to setup NRPE.



Regards

Ralph





-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of
Chris Guo
Sent: Tuesday, August 09, 2005 10:35 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] How to run nrpe daemon ?


Hi, all,

I am new to the nagios, does anybody know how to run NRPE daemon
on the remote host?
Thanks in advance.

Chris


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list