Reason for dropping contact_groups from hostgroup

Yann DIRSON yann.dirson at sagem.com
Wed Jun 8 11:18:54 CEST 2005


Andreas wrote:
> Make heavy use of templates.

Unfortunately, unless I miss something, I cannot "use" several other 
templates when building a host block, whereas I can declare my host as 
being part of several hostgroups.  And if we could, we would have to 
define precedence rules between them, which would I think be more 
complicated than just getting new contact_groups from all hostgroups.

What I do now is building new templates (ou1-os1-server, ou2-os3-server, 
ou1-infra, etc.) as the need arise.  But there are several issues:
- it is repetitive work to create them
- there are combinatory scaling issues: number of templates is #os * #ou * 
#types. For each new ou I have a number of templates, where I would only 
have to add a single hostgroup.
- all those -server templates inherit a generic-server template with a 
given contact_groups, I have to explicitely repeat it and append new 
groups, since I do not know how to just add contact_groups. Duplicated 
information is always bad, especially as the configuration gets bigger.

Indeed, I notice that nagios does not complain if I add several "use" 
clauses in a host block, but I guess the last one takes precedence, since 
it is what seems to happen with other fields like host_name. Note that if 
this is intended behaviour, I guess it should be documented in 
xodtemplate.html, but I'd be more comfortable with nagios throwing out an 
error in such cases.

And while I'm at documentation issues, I'd find it pretty useful to have 
the main doc index link to xodtemplate, and maybe templaterecursion as 
well.  Currently the user has to guess through which page going to find a 
link to this information.  Possibly some other docs would need similar 
promotion.



Message: 2
Date: Tue, 07 Jun 2005 17:44:28 +0200
From: Andreas Ericsson <ae at op5.se>
To: nagios-devel at lists.sourceforge.net
Subject: Re: [Nagios-devel] Reason for dropping contact_groups from 
hostgroup
 ?

Yann DIRSON wrote:
> Hi all,
> 
> I am using 2.0b3, and I'm hit, like others before me, by the removal of 
> "contact_groups" from the hostgroup directive.  Note that 
> docs/notifications.html in 2.0b3 still mentions this feature.
> 
> The changelog mentions that this feature was removed to make things 
> consistent with service notifications, but does not explain why this 
> feature was considered useless.
> 
> My problem is, I have many hostgroups, used to activate specific checks, 

> most notably per-organisational-unit hostgroups (not all services are 
> deployed in all OUs), but also per-OS, per-type (server, network 
> equipment, etc.).  The contacts for those machines are not the same, 
> depending on the hostgroup.  Specifying a contact_group for the 
hostgroup 
> seems the obvious way to declare this.
> 
> If I want to declare such a setup using only host definitions, I can't 
see 
> how to avoid declaring host templates for each combination of 
> ou/os/type/whatever: this clearly does not scale.
> 
> Is there a clean way to get the equivalent functionality, or should this 

> feature simply reintroduced in 2.0 ?
> 

Make heavy use of templates. That's what makes nagios scale in the first 
place, and consolidating the scaling part to one area makes it easier 
for first-time users. It's also cleaner code-wise, because things can be 
generalized and doesn't have to have so many exceptions (coders hate 
exceptions).

> 
> Another related issue, for which I did not find a solution, is how to 
send 
> service notifications to contacts defined on a per-host basis (the 
admins 
> for the machines, presumably located in the same part of the building, 
or 
> in direct contact to the users).  Maybe this could be done by adding a 
new 
> notify_host_contacts flag to services (and servicegroups), that would 
> cause service notifications to be sent to host contacts, and possibly a 
> per-host services_contact_groups, if there is a need for those contacts 
to 
> be different from the host contacts (although I have no use for the 
latter 
> myself at the moment).
> 

I've thought about implementing this myself for quite some time, 
although I had the idea that contacts should be inherited from the host 
if none were set in either the service-template or in the service object 
definition itself. Your way is cleaner, since you provide a way to both 
inherit and name contactgroups explicitly.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer






-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20




More information about the Developers mailing list