RE: [Nagios-devel] Defining services at runtime

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

RE: [Nagios-devel] Defining services at runtime

Post by Guest »

Thanks for your reply Bob, comments inline.

> -----Original Message-----
> From: Bob Ingraham [mailto:[email protected]]
> Sent: 16 May 2006 00:44
> To: Sam Stickland
> Cc: [email protected]
> Subject: RE: [Nagios-devel] Defining services at runtime
>
> Comments on your comments are inline.
>
> > -----Original Message-----
> > > It looks reality straight forward to work out how to fill out this
> > struct,
> > > but "char *host_name;" could be a problem. The plugin is only going to
> > > know
> > > the host address, so I'll need a way to get a hostname from an
> address.
> > >
> >
> >OK, that makes sense. Of course, the need to get the host_name from the
> host
> >address still remains.
>
> A way to obtain the host_name from an IP address is to use the DNS lookup
> function provided by the standard C library: gethostbyaddr()

Thanks, but I'm not sure this is what I'm looking for. This function does a
reverse DNS lookup on an IP address, whereas the host_name field in Nagios
is an arbitrary reference. When plugins get called it's easy to pass in the
host address, but they don't get passed the internal host_name (from the
configuration). However, when the broker wishes to create a new service or
submit a passive service check result it appears it is this internal
host_name that is needed.

Oh, I apologise. I've just checked the documentation and $HOSTNAME$ is a
defined macro, so this seems easily solvable.

> >* Submit passive service check results
> >
> >The old school method of doing this is via the external command file, but
> I
> >presume the new API has a method of doing this? There's some functions in
> >broker.h that look like likely candidates, but they don't even have basic
> >comments ;) (e.g. broker_service_check).
>
> The NEB Broker API (for module writers,) really only consists of the
> following five functions:
>
> nebmodule_init - initialization entry point
> nebmodule_deinit - de-init entry point
> neb_register_callback - register for an event type
> neb_deregister_callback - de-register for an event type
> neb_set_module_info - Register info about your module with Nagios
>
> That's it. Everything else you see consists of internal Nagios functions.
> The functions that you mentioned in broker.h are only used by Nagios to
> dispatch events to registered call-backs. That's all they do.
>
> For example, broker_service_check is just a dispatch routine that loops
> through all of the callback routines registered for Service Check events,
> and invokes each one with the provided service check information.
>
> That being said, there is an internal function for submitting passive
> check results. It's API is:
>
> int process_passive_service_check(time_t check_time, char *host_name, char
> *svc_description, int return_code, char *output);
>
> The parameters are just what their names imply...

Thanks, it looks like I should be able to get this up and running now.

S







This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked