Only first instance of a NEB module receives data in nagios 2.6.

Ethan Galstad nagios at nagios.org
Wed Jan 3 04:18:12 CET 2007


rouilj+nagiosdev at cs.umb.edu wrote:
> Hello:
> 
> I have the following two lines in nagios.cfg (lines split for
> readability):
> 
>   broker_module=/usr/lib/nagios/modules/ext_corr.o --file /tmp/sampler.2
>      --tag module2 --control ops01;ZSecControl
> 
>   broker_module=/usr/lib/nagios/modules/ext_corr.o --file /tmp/sampler
>      --tag module1 --control ops01;ZSecControl
> 
> This is meant to create two identical feeds of data from the module.
> 
> However only the first one seems to generate output.
> 
> In the case above, only the file /tmp/sampler (module1) receives
> events. /tmp/sampler doesn't get any output. If I reverse the order of
> the entries, then /tmp/sampler is the only file to receive output from
> the module.
> 
> The log messages:
> 
>   [1167001096] Nagios 2.6 starting... (PID=17742)
>   [1167001096] LOG VERSION: 2.0
>   [1167001096] ext_corr: module loading for --file /tmp/sampler
>      --tag module1 --control ops01;ZSecControl: $Id$ - uses open
>   [1167001096] Event broker module '/usr/lib/nagios/modules/ext_corr.o'
>      initialized successfully.
>   [1167001096] ext_corr: module loading for --file /tmp/sampler.2
>      --tag module2 --control ops01;ZSecControl: $Id$ - uses open
>   [1167001096] Event broker module '/usr/lib/nagios/modules/ext_corr.o'
>      initialized successfully.
> 
> seem to indicate that both are properly loaded and initalized. However
> the funny part is that they are loaded in the reverse order from that
> specified in the config file.
> 
> I added the following code to the beginning of
> ext_corr.o:processCallback():
> 
>     snprintf(temp_buffer,sizeof(temp_buffer)-1,"ext_corr[%s]: callback activate\
> d\n", tag);
>     temp_buffer[sizeof(temp_buffer)-1]='\x0';
>     write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE);
> 
> and this reports that only the module2 instance is receiving
> events/being called.
> 
> Is there some reason that multiple instances of a module can't
> register? Also attempting to shut down nagios hangs and it has to be
> given a kill -9 to exit.
> 
> Hmm, on further investigation I can copy ext_corr.o to ext_corr1.o and
> change the broker_module lines above and get output to both module1
> and module2. Also the debugging code shows both modules are being
> called (as expected) and exiting nagios no longer hangs.
> 
> So is this intentional? If so it is documented anywhere?
> 
> This is with nagios 2.6 plus a couple of patches that add the event
> type that the modules register for.
> 
> 				-- rouilj
> John Rouillard

This is some very interesting behavior.  I put some debugging code into 
Nagios, loaded the same module twice and watched what happened...

1.  The same module does get loaded twice
2.  Each callback results in the same function in each of the two 
modules getting executed

- BUT - the second module acts like its callback functions were never 
executed.  Very strange.  I'm thinking this odd behavior is either due 
to the way dlopen() or dlsym() operates.  Or perhaps its also partly the 
kernel's fault.

Either way, I'm not sure there's anything I can do about it internally 
in the daemon.  However, I'm not a dlopen() expert, so mabye someone 
else out there has ideas.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV




More information about the Developers mailing list