[Nagios-devel] Only first instance of a NEB module receives data in nagios 2.6.

Andreas Ericsson ae at op5.se
Wed Jan 3 09:49:00 UTC 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?
> 

I believe you need to read the man-page for dlopen() or whatever 
load-on-demand abi is installed on your system. A somewhat educated 
guess is that the dynamic loader finds it already has the file loaded 
and just returns a pointer to the already loaded file rather than 
creating a new one.

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




More information about the Nagios-devel mailing list