RE: [Nagios-devel] Defining services at runtime
Posted: Thu May 11, 2006 2:25 am
Opps, the last email got sent to soon - here's the full version:
> -----Original Message-----
> From: Sam Stickland
> Sent: 11 May 2006 11:13
> To: [email protected]
> Subject: RE: [Nagios-devel] Defining services at runtime
>
> Hi all,
>
> I've been researching this a little more, and I've come up with the
> following thoughts.
>
> I want the discovery process to be triggered by a configured service check
> on a switch - this is because I still want the standard Nagios scheduling
> mechanism to apply. When the check runs it will walk the switch, and
> gather the results, which it will then submit to my event broker module
> via a socket. The event broker module will check to see if a service
> exists for each of the switchports and if not it will create a passive
> service check for it. The event module will then submit the results for
> each of the switchports. If a switchport doesn't have any results
> submitted for 3 consecutive checks then the service will be removed.
>
> So, the event broker needs to be able accomplish the following:
>
* Check for existing services
It's unnecessary to check the Nagios configuration, since the broker module
can maintain its own internal list.
> * 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.
* 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).
I'll start checking the source for answers to all of these, but it would be
nice if someone can point me in the right direction.
S
>
> ________________________________________
> From: [email protected] [mailto:nagios-devel-
> [email protected]] On Behalf Of Sam Stickland
> Sent: 10 May 2006 09:27
> To: [email protected]
> Subject: [Nagios-devel] Defining services at runtime
>
> Hi,
>
> Is there anyway in Nagios to define services at runtime? I'll give an
> example:
>
> You have a script that monitors ports on a switch for errors. When its run
> it walks the interface error counters on the switch. For each port it
> discovers it creates a new service entry (for this host/switch) - if one
> does not already exist - and then sets the state accordingly.
>
> It would be nice if this was possible. I realise that this could be
> achieved by walking the switches and then generating a static
> configuration, but I feel this method is cleaner. It combines automatic,
> runtime discovery of switchports, along with the efficiently gains of
> having only one service check ran (instead of one service check per-port).
> I can envisage a single plug-in, which only needs to be given a hostname
> and community string to able to generate individual reports for each
> switchport for errors, queuedrops and port status.
>
> Is this possible with the new Event Broker API? Is this documented
> anywhere?
>
> S
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> -----Original Message-----
> From: Sam Stickland
> Sent: 11 May 2006 11:13
> To: [email protected]
> Subject: RE: [Nagios-devel] Defining services at runtime
>
> Hi all,
>
> I've been researching this a little more, and I've come up with the
> following thoughts.
>
> I want the discovery process to be triggered by a configured service check
> on a switch - this is because I still want the standard Nagios scheduling
> mechanism to apply. When the check runs it will walk the switch, and
> gather the results, which it will then submit to my event broker module
> via a socket. The event broker module will check to see if a service
> exists for each of the switchports and if not it will create a passive
> service check for it. The event module will then submit the results for
> each of the switchports. If a switchport doesn't have any results
> submitted for 3 consecutive checks then the service will be removed.
>
> So, the event broker needs to be able accomplish the following:
>
* Check for existing services
It's unnecessary to check the Nagios configuration, since the broker module
can maintain its own internal list.
> * 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.
* 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
I'll start checking the source for answers to all of these, but it would be
nice if someone can point me in the right direction.
S
>
> ________________________________________
> From: [email protected] [mailto:nagios-devel-
> [email protected]] On Behalf Of Sam Stickland
> Sent: 10 May 2006 09:27
> To: [email protected]
> Subject: [Nagios-devel] Defining services at runtime
>
> Hi,
>
> Is there anyway in Nagios to define services at runtime? I'll give an
> example:
>
> You have a script that monitors ports on a switch for errors. When its run
> it walks the interface error counters on the switch. For each port it
> discovers it creates a new service entry (for this host/switch) - if one
> does not already exist - and then sets the state accordingly.
>
> It would be nice if this was possible. I realise that this could be
> achieved by walking the switches and then generating a static
> configuration, but I feel this method is cleaner. It combines automatic,
> runtime discovery of switchports, along with the efficiently gains of
> having only one service check ran (instead of one service check per-port).
> I can envisage a single plug-in, which only needs to be given a hostname
> and community string to able to generate individual reports for each
> switchport for errors, queuedrops and port status.
>
> Is this possible with the new Event Broker API? Is this documented
> anywhere?
>
> S
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]