inheritance problems

Ethan Galstad nagios at nagios.org
Fri Oct 19 16:00:47 CEST 2007


Grötzner wrote:
> Hello,
> 
> in beta1 the following configuration was possible:
> 
> 
> ----------- snip ------------
> define contactgroup{
> contactgroup_name admins
> alias admins
> members contactA, contactB, contactC, contactD
> }
> 
> define host{
> use generic-fw
> host_name hostname
> alias hostalias
> address XXX.XXX.XXX.XXX
> parents someparents
> contacts contactE, !contactD
> contact_groups admins
> process_perf_data 1
> }
> ---------- snap -------------
> 
> After updating to beta4 i get the following message during verify:
> 
> Error: Contact '!contactD' specified in host 'hostalias' is not defined anywhere!
> 
> 
> Another problem occurs, when you define a contact group in the template,
> but clear it in the hosts configuration with "contact_groups null" and
> set another contact (e.g. "contacts contactA"). The contact_groups from
> the template will still be assigned, as you can see in the configuration
> overview.
> 
> This could be verified in different installations.
> 
> Best regards,
> Frank
> 

The contact/contactgroups directives in early betas all got expanded 
into a single list of contacts for a particular host or service.  That's 
why the example you provided worked in beta 1.

In later betas (b2 I think), the contact and contactgroups were 
separated out, which broke the configuration syntax you were using (at 
least they way it effectively worked).  The following syntax still 
works, but it probably doesn't achieve exactly what you want.

define host{
	name		template
	contacts	c1,c2,c3
	register 	0
	}

define host{
	name		hostname
	use		template
	contacts	c4,!c2
	}

The effective list of contacts for hostname in this case will be:

c1,c3,c4

This effectively solves the problem you're trying to address, but the 
downside is that contactgroups are not involved.  This may or may not be 
ideal for your situation.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/




More information about the Developers mailing list