Dual call to NEB callback functions. (help)

Andreas Ericsson ae at op5.se
Tue Mar 8 13:38:39 CET 2005


Haze wrote:
> Hi list,
> 
> I have been experimenting with writing an RRD based NEB module for our 
> Nagios2 clusters. Everything seemed to be going fine until I noticed a 
> number of extra calls to the NEB callback functions. In an effort to 
> track down the problem I have striped my Nagios config files and the NEB 
> module down to their bare minimum. (See attached if you are interested).
> 
> The problem seems to be that even though I only register the function 
> once with 'neb_register_callback' it gets run twice for each service in 
> an 'interval_length'. I have tried this with both the cvs snapshot and 
> the 2.0b2 tar balls.
> 

You need to discard "about-to-run" messages, like so;
int *type = (int *)data;
if(*type != NEBTYPE_SERVICECHECK_PROCESSSED) return;

For host check results, you can do exactly the same, but match against 
NEBTYPE_HOSTCHECK_PROCESSED.

In the current NEB API, the *_PROCESSED checks can be masked off using 
0x02, so you should be able to generalize with

if(!(*type & 0x02)) return;

although this might possibly change in the future and currently only 
holds true for check-events (NEBTYPE_DOWNTIME_START is 1103, f.e., which 
ofcourse masks true but still isn't a check-event).

> If someone enlightened in the ways of NEB modules has 5mins spare and 
> could have a look at the code/config and tell me if I am at fault, more 
> than likely, or if I have stumbled upon a bug.
> 

No bugs. Just the results of the lack of documentation (and a certain 
laziness in reading the header files).

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&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