add eventhandler override
Michael Friedrich
michael.friedrich at univie.ac.at
Fri Sep 17 16:41:15 CEST 2010
Hi,
Sven Nierlein wrote:
> Currently eventhandlers are executed in the main thread of nagios and block the core until the eventhandler is finished.
> Attached is a patch, which makes it possible for eventhandling neb modules to cancel/override the execution of eventhandlers.
> This is currently only possible with service and host checks. This patch would allow neb modules to stack eventhandlers on
> external queues or even distribute execution of eventhandler.
> This patch should not break the behavior of current neb modules, because their return value is currently ignored and
> execution of eventhandler will only be canceled on returning "NEBERROR_CALLBACKOVERRIDE".
>
changing the overall return value of broker_event_handler from void to
int also requires some more return values. see diff git against current
master below.
Kind regards,
Michael
diff --git a/base/broker.c b/base/broker.c
index 8c0bdd2..f99fc90 100644
--- a/base/broker.c
+++ b/base/broker.c
@@ -184,10 +184,10 @@ int broker_event_handler(int type, int flags, int
attr, int eventhandler_type, v
int return_code=OK;
if(!(event_broker_options & BROKER_EVENT_HANDLERS))
- return;
+ return OK;
if(data==NULL)
- return;
+ return ERROR;
/* get command name/args */
if(cmd!=NULL){
--
DI (FH) Michael Friedrich
Vienna University Computer Center
Universitaetsstrasse 7 A-1010 Vienna, Austria
email: michael.friedrich at univie.ac.at
phone: +43 1 4277 14359
fax: +43 1 4277 14279
web: http://www.univie.ac.at/zid
Icinga Core& IDOUtils Developer
http://www.icinga.org
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
More information about the Developers
mailing list