Page 3 of 3
Re: Broker API
Posted: Fri Dec 09, 2016 12:14 pm
by bipsen
dwhitfield wrote:bipsen wrote: Ok, with a bit of effort I succeeded in compiling the module for v4....
Did you make changes to Core? If so, the *best* thing to do is create a pull request on github.
Alternatively, could you post the changes you made? It's possible we'll merge the changes in. Thanks!
No changes made to Nagios Core - initially I have made changes to PNP4Nagios for the npcdmod broker module... I need to dig deeper in the Nagios Core sourcecode, if something should happen there. I was hoping that someone had a bit more knowledge about Core than me - and maybe could provide some input to a suggested change... But I might have to try it out myself...
The init_event_queue() function is depending on the number of hosts and services - so calling it before the parsing of config files might not be a good idea.... And changing when the broker module is loaded - well, I don't know if a module can subscribe to configuration parameters/changes - in that case, the activation of the module cannot be done before the load of the config...
Re: Broker API
Posted: Fri Dec 09, 2016 12:45 pm
by bipsen
I tried to move some of the code - I am not sure whether is has been done correctly, but at least I don't see the error anymore... Intensive testing probably needs to be made - and I don't know if the the change will affect e.g. ndoutils...
This is the change:
Code: Select all
--- nagios-4.2.3.org/base/nagios.c 2016-11-21 16:44:54.000000000 +0100
+++ nagios-4.2.3/base/nagios.c 2016-12-09 18:51:01.524492187 +0100
@@ -682,22 +682,6 @@
/* now that workers have arrived we can set the defaults */
set_loadctl_defaults();
-#ifdef USE_EVENT_BROKER
- /* load modules */
- if (neb_load_all_modules() != OK) {
- logit(NSLOG_CONFIG_ERROR, ERROR, "Error: Module loading failed. Aborting.\n");
- /* if we're dumping core, we must remove all dl-files */
- if (daemon_dumps_core)
- neb_unload_all_modules(NEBMODULE_FORCE_UNLOAD, NEBMODULE_NEB_SHUTDOWN);
- exit(EXIT_FAILURE);
- }
- timing_point("Modules loaded\n");
-
- /* send program data to broker */
- broker_program_state(NEBTYPE_PROCESS_PRELAUNCH, NEBFLAG_NONE, NEBATTR_NONE, NULL);
- timing_point("First callback made\n");
-#endif
-
/* read in all object config data */
if(result == OK)
result = read_all_object_data(config_file);
@@ -722,11 +706,6 @@
/* clean up the status data */
cleanup_status_data(TRUE);
}
-
-#ifdef USE_EVENT_BROKER
- /* send program data to broker */
- broker_program_state(NEBTYPE_PROCESS_SHUTDOWN, NEBFLAG_PROCESS_INITIATED, NEBATTR_SHUTDOWN_ABNORMAL, NULL);
-#endif
cleanup();
exit(ERROR);
}
@@ -740,8 +719,21 @@
init_event_queue();
timing_point("Event queue initialized\n");
-
#ifdef USE_EVENT_BROKER
+ /* load modules */
+ if (neb_load_all_modules() != OK) {
+ logit(NSLOG_CONFIG_ERROR, ERROR, "Error: Module loading failed. Aborting.\n");
+ /* if we're dumping core, we must remove all dl-files */
+ if (daemon_dumps_core)
+ neb_unload_all_modules(NEBMODULE_FORCE_UNLOAD, NEBMODULE_NEB_SHUTDOWN);
+ exit(EXIT_FAILURE);
+ }
+ timing_point("Modules loaded\n");
+
+ /* send program data to broker */
+ broker_program_state(NEBTYPE_PROCESS_PRELAUNCH, NEBFLAG_NONE, NEBATTR_NONE, NULL);
+ timing_point("First callback made\n");
+
/* send program data to broker */
broker_program_state(NEBTYPE_PROCESS_START, NEBFLAG_NONE, NEBATTR_NONE, NULL);
#endif
Any input welcome....
Re: Broker API
Posted: Fri Dec 09, 2016 12:55 pm
by jfrickson
tar up your php4nagios directory and either upload it here, or PM me. I can take a look at it.
Re: Broker API
Posted: Fri Dec 09, 2016 1:07 pm
by bipsen
jfrickson wrote:tar up your php4nagios directory and either upload it here, or PM me. I can take a look at it.
The easiest thing would be to PM you the SRPM generated for the code, that I created... Unfortunately, the board does not allow SRPM files... I'll try to ZIP it... Hm... it is 3 MB,. the board only allows 1MB...
Re: Broker API
Posted: Fri Dec 09, 2016 1:27 pm
by dwhitfield
It's my understanding that the two of you are working through PM/email. Is that correct? We'll leave this open of course for community input.
Re: Broker API
Posted: Fri Dec 09, 2016 2:47 pm
by bipsen
dwhitfield wrote:It's my understanding that the two of you are working through PM/email. Is that correct? We'll leave this open of course for community input.
Yes, I needed to transfer the file via PM/Email, as the forum/board had some limitations.
I will appreciate if some sort of feedback will be given on the pnp4nagios modification - and maybe also on the suggested workaround on the nagios core code, if the workaround doesn't break other things in the application...
From the looks of the forum on the pnp4nagios page, it seems like the activity on the project is limited. I like the graphing tool, though - and that is why I was trying to get the broker module to work with v4 (being able to run two different performance graphing tools during a migration from another tool, that I am using and would like to replace).
Re: Broker API
Posted: Fri Dec 09, 2016 3:04 pm
by dwhitfield
bipsen wrote:I assume, that some sort of feedback will be given on the pnp4nagios modification
That's my assumption as well. We have a public roadmaps at
https://www.nagios.com/roadmaps/. We also have internal roadmaps, but they aren't detailed enough for me to have any sense of when John might have answers for you. 4.3 is set for April and if we do fold in any of the pnp stuff into our current graphing, it might happen then.
If I had to guess, something like pulling in pnp wouldn't happen until 5.0 at the earliest, if ever, and there's not even an internal timeline for 5.0 that I know about.
I suppose you can form your own opinion about when best to check in on the status. I don't mean that to sound snarky. I just don't know what to tell you.
Re: Broker API
Posted: Fri Dec 09, 2016 3:21 pm
by bipsen
I'd just be happy to know, that it is possible to get to work (=validated) with the changes/fixes I made

. It is not so important to me whether pnp4nagios will be pulled into core or XI - if I just can be sure, that I am able to build it with the pieces available (and then publish the fixed rpm+src.rpm for other nagios core users, that would like to use the broker module with v4).
Re: Broker API
Posted: Mon Dec 12, 2016 11:00 am
by dwhitfield
We're starting to test and release pre-holiday stuff so we have time to deal with any post-release issues before leaving for a long Christmas weekend. I suspect early 2017 will be the very earliest John has a chance to look at this, although I've been wrong about his involvement in the thread up until now, so I guess we'll just see.