Empty hostgroup check in the configuration arbitrary or limitation in nagios core ?

Andreas Ericsson ae at op5.se
Tue Nov 18 15:52:10 CET 2008


L B wrote:
> Hi all,
> 
>  I didn't have any feedback from my patch, do you consider this
> feature useless ?
> 

No, but the patch does more than you intended, since it also makes
Nagios fail to produce warnings (or errors) in case the user has
given a typo so that the hostgroup simply doesn't exist at all.
The same goes for hosts. In its current state, I cannot queue it.
Sorry for the long delay. The past week has been very busy.

> As a reminder, I would like Nagios not to raise an error when it
> founds an empty hostgroup during the configuration check :
> 

Actually, what you want is that services linking to empty but
existing hostgroups should not warn. Empty hostgroups are already
valid in Nagios, but they cannot (currently) be used for assigning
services in such a way that the service definition is ignored.

>  - I define all my service checks applied to hostgroups, for example
> check_ftp applied to ftp-server-hostgroup
>  - I define hosts
>  - I add the hosts into the relevant hostgroups if I want the service
> check to be applied :
>    hostgroups +ftp-server-hostgroup,http-server-hostgroup
>  - Adding a service check is really easy like this and I can see all
> my FTP/HTTP/Whatever servers in the web interface in their hostgroup.
> 
>  But to do this, I may have empty hostgroups, and that's normal : I
> don't want to have to enable the hostgroup (by removing register 0  in
> the service definition or ...)  if I decide to add a host into it.
> 
> 
> (why should it be an error to have an empty hostgroup ?)
> 

It's not, but the config check is there to catch typos and whatnot, and
it's *useful* for that.

In order to make the patch queueable, you'll have to make sure that
it still errors out in the following conditions:
* a hostgroup_name is given but not found
* a host_name is given but not found
* neither host_name nor hostgroup_name is given, and "register" is 1

An optional bypass path would be to allow the behaviour suggested by
your patch *if* a variable named "silently_drop_orphaned_services" is
set to '1' in the nagios.cfg config file. In that case, please also
amend the documentation so that this doesn't bite anyone else. The
option must be off by default.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/




More information about the Developers mailing list