max_check_attempts, retry_check_interval, and notifications: confusion

John P. Rouillard rouilj at cs.umb.edu
Tue Mar 7 16:42:17 CET 2006


In message <20060307005225.GA5178 at think.alaya.net>,
prosolutions at gmx.net writes:
>> >I am trying to configure the following behavior from nagios:
>> >1. check a service every normal_check_interval
>> >2. if service check fails, up the check rate to retry_check_interval
>> >3. if 2 successive service checks fail, send notification
>> >4. continue to check at retry_check_interval until service check
>> >   succeeds and send notification
>> 
>> Yup 4 is the tough one.
>> 
>...
>> For nagios 2.x you can use the adaptive monitoring (see manual)
>> command: 'CHANGE_NORMAL_SVC_CHECK_INTERVAL:interval' to change the
>> interval from an event handler. I would suggest using the
>> objects.cache file to determine the configured normal_check_interval
>> and retry_check_interval. You may have to cache that info for your
>> event handler as I am not sure if that file is re-written when the
>> intervals change.
>> 
>
>Thanks for your help.  Too bad nagios doesn't simply have object
>configuration file options such as:
>
>normal_check_interval    - how often to normally check when all OK
>warning_check_interval   - how often to check when WARNING
>critical_check_interval  - how often to check when CRITICAL
>number_of_warnings_notification  - after how many WARNING checks to send
>notification
>number_of_critical_notification  - after how many CRITICAL checks to
>send notification

Yeah. I used SEC to correlate when I need this level of detailed
correlation. Once you start getting to this level of detail you often
find out that you want different types of warnings/critical events
handled differently.

>at any rate the external command CHANGE_NORMAL_SVC_CHECK_INTERVAL does
>seem to almost do what I want with one small problem: Service event
>handlers recieve the following 3 macros: $SERVICESTATE$, $SERVICESTATETYPE$,
> $SERVICEATTEMPT$, yet in order to run CHANGE_NORMAL_SVC_CHECK_INTERVAL via 
>an external command/event handler I need to provide the following to it:
>
>CHANGE_NORMAL_SVC_CHECK_INTERVAL;host1;service1;15\n" $now > $commandfile
>
>unfortunately $host$ is not provided to the external command via the
>event handler.

Seems $HOSTNAME$ is provided:
   http://nagios.sourceforge.net/docs/2_0/macros.html
so just add it to the event handler description. E.G.

  define command {
	command_name handle_PortScanCheck
	command_line $USER2$/PortScanCheck $SERVICEATTEMPT$ $SERVICESTATE$ $HOSTADDRESS$ '$SERVICEOUTPUT$'
  }

I use HOSTADDRESS rather then HOSTNAME, but it should still work.

>I'm not sure how to tell my external command for what
>host it should be changing the normal_check_interval.  How is the
>external command supposed to know which host triggered its event
>handler?

It all depends on what arguments you define for the event handler.
Also with 2.0 I think all macros are in the environment as well, so
you can get NAGIOS_HOSTNAME from the environment rather then passing
it on the command line.

				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
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