Passive checks? (NSCA)

tvilliers tvilliers at lastminute.com
Wed Dec 31 11:07:46 CET 2003


On Tue, 30 Dec 2003 16:45:39 -0600, Michael Tucker wrote:

> What do I need to do to make passive service checks
> work?

Here is a "mini howto" I wrote a while ago:

================================
NAGIOS PASSIVE CHECKS mini HOWTO 
================================

>From the Nagios Manual:
/passivechecks.html
/extcommands.html
More:
/commandfile.html
/volatileservices.html
/eventhandlers.html
Even more:
/freshness.html
/distributed.html

Active checks are initiated by Nagios, while passive checks are performed
by external applications. Once an external application has performed a 
service check, it submits the results of the service "check" to Nagios
through the external command file.

By default, Nagios does not check for, or process any external commands.
To enable it, set the following in "nagios.cfg":
##
check_external_commands=1  ## On
command_check_interval=-1  ## As often as possible
command_file=/usr/local/nagios/var/rw/nagios.cmd
##

Setup permissions on the directory containing the external command file:
##
- Create a new Nagios Command group:
#$ groupadd nagioscmd
- Add the web server user (nobody or apache, etc) and the Nagios user
(nagios) to the newly created group:
#$ usermod -G nagioscmd nagios
#$ usermod -G nagioscmd nobody
- Create the directory where the command file should be stored:
#$ mkdir /usr/local/nagios/var/rw
- Change the ownership of the directory:
#$ chown nagios.nagioscmd /usr/local/nagios/var/rw
- Ensure the Nagios user has full permissions on the directory:
#$ chmod u+rwx /usr/local/nagios/var/rw
- Ensure the Nagios Command group has full permissions on the directory:
#$ chmod g+rwx /usr/local/nagios/var/rw
- Enable the group sticky bit on the directory:
#$ chmod g+s /usr/local/nagios/var/rw
- Check the permissions by running 'ls -al /usr/local/nagios/var':
## drwxrws---   2 nagios nagioscmd     1024 Aug 11 16:30 rw

Restart the web server.

Create a "passive_test" service by adding this entry to 
"/usr/local/nagios/etc/services.cfg":
##
define service {
  use                           generic-service ; your template
  host_name                     localhost
  service_description           passive_test
  is_volatile                   1 ; every change is logged ...
  max_check_attempts            1 ; a change is after only 1 try ...
  active_checks_enabled         0 ; unset template's default ...
  passive_checks_enabled        1 ; ditto ...
  check_freshness               0
  freshness_threshold           300
  notification_options          n ; no notifications ...
  check_command			"" ; nagios requires something ...
}
##

Restart Nagios.

In the Browser Console:
- Click "Service Detail" in Main Menu and look for a new 
  Passive Service at "localhost" called "passive_test"
- Click the "passive_test" link
- Click "Submit passive check result for this service" 
  on "Service Commands" menu.
- Submit a value in the "Check Output" line and click "Commit"
- Click "Service Detail" in Main Menu and see if the new 
  Passive Service at "localhost" displays this value

Success with "builtin" external check commands.

The format of an external check command is as follows:
[<timestamp>] PROCESS_SERVICE_CHECK_RESULT;<host_name>;<description>; \
  <return_code>;<plugin_output>
where timestamp is a UNIX time

Copy this script from Nagios source directory:
#$ cp $SRC/nagios-1.1/contrib/eventhandlers/submit_check_result \
#$   /usr/local/nagios/libexec/eventhandlers
Edit this line to correspond to Nagios installation:
##
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
##

>From the command line:
#$ /usr/local/nagios/libexec/eventhandlers/submit_check_result \
#$   localhost passive_test 0 OK
- Tail the Nagios log file ("tail -f /usr/local/nagios/var/nagios.log") :
##
[1065703739] EXTERNAL COMMAND: \
  PROCESS_SERVICE_CHECK_RESULT;localhost;passive_test;0;OK
##
- Check in the browser to see if new status is updated.

Success from localhost.






-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
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