Nrpe: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
No edit summary
Boiarino (talk | contribs)
No edit summary
Line 1: Line 1:
clonweb only (where Nagios is running): produce 'check_nrpe' and copy it to 'nagios' area:
We need two programs: 'nrpe' to be run as daemon or inet service, and 'check_nrpe' to be called
by nagios. In general we need 'check_nrpe' on clonweb and 'nrpe' on all other machines.
 
Clonweb only (where Nagios is running): produce 'check_nrpe' and copy it to 'nagios' area:


   cd /usr/local/src/nrpe-2.6
   cd /usr/local/src/nrpe-2.6
Line 7: Line 10:
   chown nagios.nagios /www/nagios2.6/libexec/check_nrpe
   chown nagios.nagios /www/nagios2.6/libexec/check_nrpe


 
Generic installation (all machines, including clonweb if it is not done yet):
 
 
 
 
In general:


   cd /usr/local/src
   cd /usr/local/src
Line 21: Line 19:
   cd /usr/local/src/nrpe-2.6
   cd /usr/local/src/nrpe-2.6
   ./configure --prefix=/apps/nrpe2.6 --enable-command-args
   ./configure --prefix=/apps/nrpe2.6 --enable-command-args
During that step sparc said:
  checking for SSL... SSL found in /usr/local
  *** Generating DH Parameters for SSL/TLS ***
  warning, not much extra random data, consider using the -rand option
  Generating DH parameters, 512 bit long safe prime, generator 2
  This is going to take a long time
  4638:error:24064064:random number generator:SSLEAY_RAND_BYTES:PRNG not seeded:md_rand.c:503:
  You need to read the OpenSSL FAQ,  http://www.openssl.org/support/faq.html
  4638:error:05068003:Diffie-Hellman routines:DH_generate_parameters:BN lib:dh_gen.c:154:


Compiling:
Compiling:
Line 37: Line 24:
   make all
   make all


On clonweb (where Nagios is running) (if is not done as described above):
On clonweb (where Nagios is running):


   cp src/check_nrpe /www/nagios2.6/libexec
   cp src/check_nrpe /www/nagios2.6/libexec
Line 63: Line 50:
   command[check_disk]=/apps/nrpe2.6/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
   command[check_disk]=/apps/nrpe2.6/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$


on clonweb: copy pluging we want to execute remotely
on clonweb: copy plugins we want to execute remotely


(remote machines will not see /www, only /apps !!!)
(remote machines will not see /www, only /apps !!!)
Line 69: Line 56:




To test 'check_nrpe' run following commands from another machine where nrpe installed:
To test 'check_nrpe' run following commands from another machine where 'check_nrpe' installed.
Requests shell be sent to the machine where 'nrpe' is running (in our examples it is clon10):


on clonweb:
on clonweb:
Line 89: Line 77:
NOTE: user 'nagios' and group 'nagios' must exist to run 'nrpe' daemon !!!
NOTE: user 'nagios' and group 'nagios' must exist to run 'nrpe' daemon !!!
To create user on Solaris:  'useradd -d /home/nagios -m -c "Nagios" nagios' (-m will force home directory creation).
To create user on Solaris:  'useradd -d /home/nagios -m -c "Nagios" nagios' (-m will force home directory creation).
if complains, check passwd file by 'pwconv' (should not be blank lines !!!).
If complains, check passwd file by 'pwconv' (should not be blank lines in the end etc).
To add group on Solaris add following line to '/etc/group' file: 'nagios::9997:nagios' (id maybe different of course).
To add group on Solaris add following line to '/etc/group' file: 'nagios::9997:nagios' (id maybe different of course).
On Linux use system-config-.. utility.
On Linux use '/usr/bin/system-config-users' utility.


To start/stop 'nrpe' daemon on Linux (as 'root'):
To start/stop/restart 'nrpe' daemon on Linux (as 'root'):


   /etc/init.d/nrpe start
   /etc/init.d/nrpe start
   /etc/init.d/nrpe stop
   /etc/init.d/nrpe stop
  /etc/init.d/nrpe restart


To start 'nrpe' daemon on Solaris (as 'root'):
To start 'nrpe' daemon on Solaris (as 'root'):
Line 110: Line 99:
In both systems it is running under user 'nagios' in according to it's config file.
In both systems it is running under user 'nagios' in according to it's config file.


We are running 'nrpe' not as a daemon but as part of 'inet' service. It was configured
Normally we are running 'nrpe' not as a daemon but as part of 'inet' service. It was configured
by following steps:
by following steps:



Revision as of 01:21, 7 January 2007

We need two programs: 'nrpe' to be run as daemon or inet service, and 'check_nrpe' to be called by nagios. In general we need 'check_nrpe' on clonweb and 'nrpe' on all other machines.

Clonweb only (where Nagios is running): produce 'check_nrpe' and copy it to 'nagios' area:

 cd /usr/local/src/nrpe-2.6
 ./configure
 make all
 cp src/check_nrpe /www/nagios2.6/libexec
 chown nagios.nagios /www/nagios2.6/libexec/check_nrpe

Generic installation (all machines, including clonweb if it is not done yet):

 cd /usr/local/src
 cp ../downloads/nrpe-2.6.tar.gz .
 gunzip nrpe-2.6.tar.gz
 tar xvf nrpe-2.6.tar
 rm nrpe-2.6.tar
 cd /usr/local/src/nrpe-2.6
 ./configure --prefix=/apps/nrpe2.6 --enable-command-args

Compiling:

 make all

On clonweb (where Nagios is running):

 cp src/check_nrpe /www/nagios2.6/libexec

On any other machine which suppose to be remotely monitored by clonweb:

 mkdir /apps/nrpe2.6
 mkdir /apps/nrpe2.6/libexec
 mkdir /apps/nrpe2.6/etc
 mkdir /apps/nrpe2.6/bin
 cp sample-config/nrpe.cfg /apps/nrpe2.6/etc/
 cp src/nrpe /apps/nrpe2.6/bin
 cp src/check_nrpe /apps/nrpe2.6/libexec/
 cp init-script /etc/init.d/nrpe
 emacs /etc/init.d/nrpe:
 # config: /apps/nrpe2.6/etc/nrpe.cfg
 NrpeBin=/apps/nrpe2.6/bin/nrpe
 NrpeCfg=/apps/nrpe2.6/etc/nrpe.cfg

emacs /apps/nrpe2.6/etc/nrpe.cfg:

 dont_blame_nrpe=1
 command[check_disk_test]=/apps/nrpe2.6/libexec/check_disk -w 20 -c 10 -p /
 command[check_disk]=/apps/nrpe2.6/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

on clonweb: copy plugins we want to execute remotely

(remote machines will not see /www, only /apps !!!) cp /www/nagios2.6/libexec/check_disk /apps/nrpe2.6/libexec/


To test 'check_nrpe' run following commands from another machine where 'check_nrpe' installed. Requests shell be sent to the machine where 'nrpe' is running (in our examples it is clon10):

on clonweb:

 /www/nagios2.6/libexec/check_nrpe -H clon10 -c check_disk_test
     must return something like that:
DISK OK - free space: / 1363 MB (16% inode=74%);| /=7054MB;8483;8493;0;8503
 /www/nagios2.6/libexec/check_nrpe -H clon10 -c check_disk -a 20 20 /
 

on non-clonweb:

 /apps/nrpe2.6/libexec/check_nrpe -H clon10 -c check_disk_test
 /apps/nrpe2.6/libexec/check_nrpe -H clon10 -c check_disk -a 20 20 /

Testing 'nrpe':

NOTE: user 'nagios' and group 'nagios' must exist to run 'nrpe' daemon !!! To create user on Solaris: 'useradd -d /home/nagios -m -c "Nagios" nagios' (-m will force home directory creation). If complains, check passwd file by 'pwconv' (should not be blank lines in the end etc). To add group on Solaris add following line to '/etc/group' file: 'nagios::9997:nagios' (id maybe different of course). On Linux use '/usr/bin/system-config-users' utility.

To start/stop/restart 'nrpe' daemon on Linux (as 'root'):

 /etc/init.d/nrpe start
 /etc/init.d/nrpe stop
 /etc/init.d/nrpe restart

To start 'nrpe' daemon on Solaris (as 'root'):

 /apps/nrpe2.6/bin/nrpe -c /apps/nrpe2.6/etc/nrpe.cfg -d
 ps -ef | grep nrpe
 nagios  3051     1   0 13:09:24 ?           0:00  ./nrpe -c /apps/nrpe2.6/etc/nrpe.cfg -d
 more /var/run/nrpe.pid
 3051

In both systems it is running under user 'nagios' in according to it's config file.

Normally we are running 'nrpe' not as a daemon but as part of 'inet' service. It was configured by following steps:

 ...



 Create a command definition in your Nagios config
 file for the NRPE client.  See the README file for
 more info on doing this.
 NOTE: remote host(s) must be running the NRPE daemon !!!
    - Copy the nrpe daemon to /usr/sbin, /apps/nagios2.6
      or wherever you feel it fits best.
    - Copy the sample nrpe.cfg config file to /etc,
      /apps/nagios2.6 or wherever you feel it fits best.
    - Modify the /etc/services file and configure NRPE to
      run under inetd, xinetd, or as a standalone daemon.
      See the README file for more info on doing this.