Question about NEB
Hendrik Baecker
b00mer at gmx.net
Sat Oct 22 07:46:24 CEST 2005
Hi all,
Guess what... I've got it!!
I've never thougt about the nebstruct_service_check_data---->> type that
tolds me if a Service Check was just initiated or processed.
I belive your eyes are roling because of my stupid error.
@Andreas: Thanks a lot for just showing me the right way and not the
right code.
Best wishes for the further working
Your crazy dancing
Hendrik ;))
Andreas Ericsson schrieb:
> 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.
>>>
>>
>>
>
-------------------------------------------------------
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