[Nagios-devel] Defining services at runtime

moshe sharon moshesharon at gmail.com
Thu May 11 20:03:39 CEST 2006


Hello


i dont know if it helps but there is a plugins called check_find_new_hosts
at nagiosexchange
http://www.nagiosexchange.org/Networking.53.0.html?&tx_netnagext_pi1[p_view]=275

basically it adds new hosts to nagios when it runs. i did not test it and im
not sure about services but im pretty sure it can be extended
to do what you need

Hope it helped
Moshe Sharon

On 5/11/06, Sam Stickland <sam_mailinglists at spacething.org> wrote:
>
> Thanks for your reply Bob.
>
> Comments are inline.
>
> > -----Original Message-----
> > From: nagios-devel-admin at lists.sourceforge.net [mailto:nagios-devel-
> > admin at lists.sourceforge.net] On Behalf Of Bob Ingraham
> > Sent: 11 May 2006 15:08
> > To: Sam Stickland
> > Cc: nagios-devel at lists.sourceforge.net
> > Subject: RE: [Nagios-devel] Defining services at runtime
>
>
> > >
> > > * Create for existing services
> > >
> > > I notice that Nagios-db gets it's configuration information from the
> > > following callback:
> >
> >
> > Which callback were you thinking of?
>
> The message got sent too early first time around. The second message
> didn't
> mention this :)
>
> > > * Create a new service check
> > >
> > > nebstructs.h defines a struct "nebstruct_service_check_struct".
> However,
> > > this seems to be the only place this struct is referred to in the
> header
> > > files. How do I pass a completed struct to Nagios?
> > >
> > > 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.
> >
> > You can't add a service to Nagios using the
> > nebstruct_service_check_struct; in fact you can't add anything to Nagios
> > using any of the nebstruct_* structure.  They are one-way, informational
> > only - passed down to your module.  When your module returns, Nagios
> never
> > examines the structure that it passed to you for changes.
> >
> > The way to add a service from within a NEB module would be to call the
> > internal "add_service()" function.  It's the same one that Nagios uses
> to
> > add services during configuration load.
> >
> > The API for the add_service() function is:
>
> OK, that makes sense. Of course, the need to get the host_name from the
> host
> address still remains.
>
> > However, you have a significant problem with your above strategy:
>
>
> > So, you have a timing issue:
>
> > One strategy might be to have your service_check either:
> >
> > - Return the list of services it wants created as a result string
> > (although, you might not have enough space to do so on one line,) and
> then
> > have your callback routine create services based on the contents of the
> > results string, or
> >
> > - Your service check writes it results to a temp file or IPC message
> queue
> > or some such, and your callback routine then reads this file (or from
> the
> > message queue,) and creates the services based upon that information
> > source.
> >
> > I'm sure that there are many other ways to do this...
> >
> > Anyway, anyone please correct me if I'm off on any of this, but that's
> how
> > I understand the way the callback routine mechanism works.
>
> Yes, I understand the issue here. The code here
>
> http://www.louisville.edu/~tjande01/nagios/exthandler.c
>
> uses a schedule_new_event callback that executes once a second in order to
> handle the socket code. Personally, I'd prefer to spawn a new thread to
> handle the socket communication with the check-command. This ties into the
> last thing that got missed off my original email that is:
>
> * 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 check-command that reports back to the broker module would only return
> state based on its ability to reach the switch and to talk to the broker
> module.
>
> Sam
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060511/e97b2678/attachment.html>


More information about the Users mailing list