Setting flapping state via external command

Andreas Ericsson ae at op5.se
Tue Oct 11 08:37:45 CEST 2005


John P. Rouillard wrote:
> Andreas Ericsson wrote:
> 
>>John P. Rouillard wrote:
>>
>>>While I like the concept behind nagios's flap detection, I have to
>>>wonder if anybody besides me thought it would be a good idea to be
>>>able to use an external command (e.g. SEC the simple event correlator)
>>>to set the state of a service or host to flapping and clear it again?
>>>
>>>This would allow much finer grained control over flapping
>>>determination e.g. you could look at the last 22 states or the last 10
>>>states for flap detection rather than at nagios's default of 21.  You
>>>could also change flap detection depending on time of day, the state
>>>of the rest of the network etc. and allow adaptive flap detection.
>>
>>There is no such mechanism in place today. A NEB-module might be able to 
>>help you there though and shouldn't be too hard to write so long as you 
>>keep it fairly small and make sure it's stateless (creating threads in 
>>modules can wreak some fairly serious havok on nagios due to certain 
>>global variables being initialized more than once).
> 
> 
> Hmm, I always thought of a NEB module as a way of getting information
> from the nagios core into other applications. E.G. events/status info
> into a database, or report the flapping event to an external
> program. What I want to do is call:
> 
>     set_service_flap()
>     clear_service_flap()
> 
>    and 
> 
>     set_host_flap()
>     clear_host_flap()
> 
> from base/flapping.c when an external program identifies a flapping
> state. I can see how a NEB module would be useful in feeding the
> external program with alerts/events. So am I misunderstanding the
> abilities of the NEB module?
> 

Yes. NEB modules are basically like kernel modules. They trigger on 
events. Support is far from complete yet (anything going into the FIFO 
that nagios doesn't understand is discarded instead of being passed to 
modules, modules aren't allowed to try and understand things in the 
object configuration and so on), but it can do what you want.

I suggest using a second named pipe (or udp socket) and then scheduling 
an event to run every three seconds to poll the fifo/socket for input.

It should be about two hours work for a skilled C-programmer. Make sure 
you use Nagios 2.0b4 to do it though, since the API changed between 
2.0b3 and 2.0b4.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
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