Question about NEB

Andreas Ericsson ae at op5.se
Fri Oct 21 15:57:32 CEST 2005


Hendrik Baecker wrote:
> Hi,
> 
> OCSP negative.
> 
> obsess_over_services=0
> #ocsp_command=somecommand
> 
> Since, at first step, I want only to log the things that nrpe must have, 
> in my nagios.log (which you can see in my last post) there is no single 
> executed nsca (at the moment) just logging...
> 
> I am sorry, but I don't understood your second part...
> I am not quiet family with neb and c-coding... just figguring out what 
> can be done and learning...
> 
> I thought, that my "neb_register_callback" tells the Nagios Core, that 
> my module want to have service_check_data and that the core should call 
> my module function "nsca_neb_handle_data".
> 
> AFAIR, there is no way for my module to tell the core, that I just want 
> to have service_data after the check... or am I missing something?
> 

There isn't, but you're missing something. Check the type of the 
callback struct. It's supposed to equal the proper *_PROCESSED macro in 
broker.h.

> " and AFAIR it should segfault if you try to use the plugin output 
> before the check is run. "
> 
> I think, please correct me:
> 
> 1. Nagios-Core executes a service check.
> 2. Nagios-Core reaper gets the result.
> 3. Nagios-Core gives callback to my module and fills out the struct 
> nebstruct_service_check_data which my mods just reading out and plays with.
> 

0: core tells modules it's time to run a check
1: core runs the check
2: reaper reaps (it always does...)
3: core calls module with the completed check result

> When I am missing something in the logic, please tell me and I will go 
> back to my attic for study the source and come back with more (hopefully 
> better) ideas.
> 

Since you're mentioning it, you might want to just add a callback for a 
service check and then rely on the fact that Nagios passes the proper 
value rather than adding the switch() case thingie.

> Regards
> Hendrik
> 
> Andreas Ericsson schrieb:
> 
>> Hendrik Baecker wrote:
>>
>>> Hi List,
>>>
>>> now I've changed some code from Ethan's helloworld.c NEB to give me 
>>> NEB Callbacks from Nagios Core.
>>>
>>> I've registered a callback for Service Check data like this:
>>>
>>>    
>>> neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA,nsca_neb_module_handle,0,nsca_neb_handle_data); 
>>>
>>>
>>> and I am processing this Service Checkdata just in that way, that I 
>>> want to see them in the log:
>>>
>>> ###
>>>
>>> case NEBCALLBACK_SERVICE_CHECK_DATA:
>>>                if((scdata=(nebstruct_service_check_data *)data)){
>>>                        
>>> snprintf(temp_buffer,sizeof(temp_buffer)-1,"nsca_neb:%s\t%s\t%d\t%s",(scdata->host_name), 
>>>
>>>                                    (scdata->service_description), 
>>> (scdata->return_code), (scdata->output));
>>>                        temp_buffer[sizeof(temp_buffer)-1]='\x0';
>>>                        
>>> write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE);
>>>             }
>>> break;
>>>
>>> .....
>>>
>>> ###
>>>
>>> I am a little confused, cause I am getting two (different) Log 
>>> entries for each service check!
>>>
>>> Log-Output:
>>>
>>> [1129892835] nsca_neb:Nagios_Slave      Disk /usr       0       DISK 
>>> OK - free space: /usr 3425 MB (57%):
>>> [1129892836] nsca_neb:Nagios_Slave      Disk /usr       0       DISK 
>>> OK - free space: /usr 3425 MB (57%):
>>> [1129892854] nsca_neb:Nagios_Master     Disk /var       0       DISK 
>>> OK - free space: /var 2865 MB (57%):
>>> [1129892855] nsca_neb:Nagios_Master     Disk /var       0       DISK 
>>> OK - free space: /var 2865 MB (57%):
>>>
>>> On the other side I have perfdata enabled and just see one entry for 
>>> each check.
>>>
>>> Can anyone explain?
>>>
>>> Is it a feature? Is it a bug?
>>>
>>
>> I think you've still got the ocsp-command (or oscp or something) 
>> enabled, so that the Nagios core and the module are both running 
>> send_nsca.
>>
>> You also need to watch out for Nagios calling the module twice for 
>> each check it does. Once before and once after. This isn't likely to 
>> be what you're seeing though, because the two entries that are 
>> temporally close to each other have identical plugin output and AFAIR 
>> it should segfault if you try to use the plugin output before the 
>> check is run.
>>
> 
> 

-- 
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