AW: Processing all messages with NEB
Mohr James
james.mohr at elaxy.com
Mon Oct 24 08:16:10 CEST 2005
Hi Andreas!
Thank you very much for your prompt and very useful response. There are
a few comments below:
<SNIP>
>> >
>> > int helloworld_handle_status(int event_type, void *data){ char
>> > temp_buffer[1024]; service * tmp_service;
>> > nebstruct_service_status_data * service_status_data; if(
>> > (service_status_data=(nebstruct_service_status_data *)data) ){
>> > tmp_service = (service *) service_status_data->object_ptr;
>> > snprintf(temp_buffer,sizeof(temp_buffer)-1,"EVENT: %d MESSAGE:
>> > %s",event_type,tmp_service->plugin_output); }
>> > write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE); /*
>> > write_to_all_logs("inside:
>> > helloworld_handle_status",NSLOG_INFO_MESSAGE); */ }
>> >
>> > However, when use tmp_service->plugin_output, it says
>> "structure has
>> > no member named `plugin_output'". Inside of
>> ../include/ojects.h, there
>> > is the definition of the service_struct, which shows me
>> >
>> > char *plugin_output;
>> >
>> > However, this is within an the block #ifdef NSCORE.
>>
>> Which is correct. All NEB-modules must #define NSCORE, since
>> that's where they'll be running. #ifndef NSCORE is for the cgi's.
>>
>> > Moving the line
>> > outside of the block, it will compile but when I send
>> something to a
>> > service with send_nsca the value of plugin_output ends up
>> being null.
>> > So, I am at a loss how to get the text of the plugin_output.
>> >
>>
>> This is because you're fetching it from
>> service_status_data->object_ptr->plugin_output which isn't
>> filled in by the time you get the data.
>>
>> You need to reference service_status_data->output instead.
After I sent the email, I moved the #define NSCORE to the very beginning
of the source file (before *all* of the includes. This seemed to catch
everything and there were no compile errors even after moving
tmp_service->plugin_output back to the right place in objects.h. I'll
try it with service_status_data->output and see how that works.
>> Please keep in mind that the neb-code is to be considered
>> fairly volatile. It's possible (and quite likely) that some
>> of the variables of the nebstruct_*_data structs will
>> disappear in the next overhaul.
Thanks for the warning! ;-) Is there an announcement mailing list or
something?
>> > I have looked at th code for the mysql inserter module.
>> However, I get
>> > stuck here as well.One thing that is unclear is whether **all**
>> > messages get sent through here or just the status changes.
>> I need all
>> > of the messages and not just the status changes.
>> >
>>
>> All results of all checks are passed through the modules.
>> Once before the plugin is executed and once after.
I figured as much. I managed to change the message text (see below), but
it was getting changed twiced.
>> > An additional goal is to be able to process and change the
>> messages
>> > before being sent to the GUI. For example, the text
>> contains a code
>> > number which tells the system to change the text to a
>> specific URL so
>> > all you need to do is click on the message text to get
>> instructions
>> > on what to do in a specific case. However, I have not yet
>> figured out
>> > how to change the message that appears in the GUI.
>> >
>>
>> You can rewrite it with a module. Make sure you take care
>> not to leak any memory.
Thanks for the tip. The last time I did any C code at this level was 10
years ago so I can use all the help I can get.
>> You're on your own when it comes to writing new code. I'll
>> gladly answer neb-module questions though, so it at least
>> gets documented somewhere.
"In the next world, you're on your own."
Well then, you will probably be hearing a lot from me. ;-)
In addition to my "real" job I am a professional writer and I love to
write. What I can do it to take the material that is passed back and
forth in the mailing list and try to put it together in something
coherent. I have already started putting my notes together and will post
them on my web site as I progress (I hope).
Regards,
Jim Mohr
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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