Page 1 of 3

Broker API

Posted: Tue Dec 06, 2016 11:54 pm
by bipsen
Hi

A note on PNP4Nagios states, that the broker module doesn't work with nagios core v4 due to incompatibility with the broker module/interface - they state, that it have changed.

I have not been able to find any updated documentation on the event broker API - the only thing I can find is http://nagios.sourceforge.net/download/ ... %20API.pdf

Does anyone know what the issue is? Or should the PNP4Nagios broker module just be re-compiled on a host with Nagios Core v4 ?

Regards
B

Re: Broker API

Posted: Wed Dec 07, 2016 5:26 am
by rhassing
I'm not familiar with the broker api, but I've got pnp4nagios working with all my Nagios Core 4.X installations.

Re: Broker API

Posted: Wed Dec 07, 2016 11:30 am
by dwhitfield
Could you post any error messages you get when using it? Screenshots are nice if it is a GUI error. If it is command line, we'd like to know which user is running the command. Thanks!

Re: Broker API

Posted: Thu Dec 08, 2016 2:05 am
by bipsen
The nagios.log states:

Code: Select all

[1481180471] Nagios 4.2.3 starting... (PID=10018)
[1481180471] Local time is Thu Dec 08 08:01:11 CET 2016
[1481180471] LOG VERSION: 2.0
[1481180471] qh: Socket '/var/nagios/rw/nagios.qh' successfully initialized
[1481180471] qh: core query handler registered
[1481180471] nerd: Channel hostchecks registered successfully
[1481180471] nerd: Channel servicechecks registered successfully
[1481180471] nerd: Channel opathchecks registered successfully
[1481180471] nerd: Fully initialized and ready to rock!
[1481180471] wproc: Successfully registered manager as @wproc with query handler
[1481180471] wproc: Registry request: name=Core Worker 10023;pid=10023
[1481180471] wproc: Registry request: name=Core Worker 10021;pid=10021
[1481180471] wproc: Registry request: name=Core Worker 10020;pid=10020
[1481180471] wproc: Registry request: name=Core Worker 10022;pid=10022
[1481180471] Error: Module '/usr/lib64/nagios/brokers/npcdmod.o' is using an old or unspecified version of the event broker API.  Module will be unloaded.
[1481180471] Event broker module '/usr/lib64/nagios/brokers/npcdmod.o' deinitialized successfully.
[1481180471] Error: Failed to load module '/usr/lib64/nagios/brokers/npcdmod.o'.
[1481180471] Error: Module loading failed. Aborting.
I am not sure whether it just is a recompile for Nagios v4, that is required....

/Brian

Re: Broker API

Posted: Thu Dec 08, 2016 2:30 am
by bipsen
rhassing wrote:I'm not familiar with the broker api, but I've got pnp4nagios working with all my Nagios Core 4.X installations.
It is possible - but not with the broker module....

/Brian

Re: Broker API

Posted: Thu Dec 08, 2016 10:45 am
by dwhitfield
Judging by your last post, maybe you already figured this out, but unfortunately, the following is right at the top of https://docs.pnp4nagios.org/
PNP4Nagios Broker Module npcdmod.o is not compatible with Nagios Core 4.x

pnp4nagios is not our product, so it is not something we will be "fixing". That said, I invite you to post a feature request for Nagios Core at https://github.com/NagiosEnterprises/na ... issues/new. Maybe it's something that could be added to 5, or even 4.3. I'm not a developer, so I can really say if or when.

With that out of the way, is it ok if we go ahead and lock the thread?

Re: Broker API

Posted: Thu Dec 08, 2016 12:07 pm
by bipsen
Hi

I was just wondering how big the change was from v3 to v4 .. But judging from the header files, and trying to compile pnp4nagios with the v4 headers, it looks like the code needs some rewriting...

I also know, that it is an add-on product, and not a part of the nagios components/suite. I was trying to figure out if any description existed on the changes between 3.x and 4.x. But it seems like that information primarily can be found by investigating the header files.

You can lock the thread...Thanks

/Brian

Re: Broker API

Posted: Thu Dec 08, 2016 12:15 pm
by dwhitfield
Well, there's certainly a changelog available at https://github.com/NagiosEnterprises/na ... /Changelog. Is there anything specific missing from the changelog you'd like to know about?

Re: Broker API

Posted: Thu Dec 08, 2016 12:28 pm
by bipsen
¨Hi

When compiling the pnp4nagios code, I get

Code: Select all

npcdmod.c: In function ânpcdmod_handle_dataâ:
npcdmod.c:275: error: âserviceâ has no member named âservice_check_commandâ
It comes from a service_struct (objects.h) - where service_check_command apparently was included in the structure in v3 - but maybe it has been renamed to check_command instead....

/Brian

Re: Broker API

Posted: Thu Dec 08, 2016 1:10 pm
by bipsen
Hi again

Ok, with a bit of effort I succeeded in compiling the module for v4.... I have one small error message, though - which I just need to find out if it comes from the broker module or Nagios itself...

The log:

Code: Select all

[1481220514] Nagios 4.2.3 starting... (PID=16205)
[1481220514] Local time is Thu Dec 08 19:08:34 CET 2016
[1481220514] LOG VERSION: 2.0
[1481220514] qh: Socket '/var/nagios/rw/nagios.qh' successfully initialized
[1481220514] qh: core query handler registered
[1481220514] nerd: Channel hostchecks registered successfully
[1481220514] nerd: Channel servicechecks registered successfully
[1481220514] nerd: Channel opathchecks registered successfully
[1481220514] nerd: Fully initialized and ready to rock!
[1481220514] wproc: Successfully registered manager as @wproc with query handler
[1481220514] wproc: Registry request: name=Core Worker 16209;pid=16209
[1481220514] wproc: Registry request: name=Core Worker 16207;pid=16207
[1481220514] wproc: Registry request: name=Core Worker 16208;pid=16208
[1481220514] wproc: Registry request: name=Core Worker 16210;pid=16210
[1481220514] npcdmod: Copyright (c) 2008-2009 Hendrik Baecker ([email protected]) - http://www.pnp4nagios.org
[1481220514] npcdmod: /etc/pnp4nagios/npcd.cfg initialized
[1481220514] npcdmod: spool_dir = '/var/spool/pnp4nagios'.
[1481220514] npcdmod: perfdata file '/var/log/pnp4nagios/perfdata.dump'.
[1481220514] npcdmod: Ready to run to have some fun!
[1481220514] Error: Failed to add event to squeue '(nil)' with prio 1: Success
[1481220514] Event broker module '/usr/lib64/nagios/brokers/npcdmod.o' initialized successfully.
It is the entry "Error: Failed to add event to squeue '(nil)' with prio 1: Success" ....

/Brian