Service Template Inheritance

Chris Beattie cbeattie at geninfo.com
Mon Mar 23 18:27:07 CET 2009


Ken Netzorg wrote:
> 
> Having read the documentation and doing some pondering, I am looking to 
> break my service monitoring into two notification trees: Production and 
> Development. That way, I am not bothered by development services 
> alerting off hours and only get production notifications off hours. (If 
> there is a better way to set this up, I'm open to suggestions.) 

Service checks can inherit their notification period from their 
associated host object.  I set up my host templates for my dev and 
production servers with different notification periods, but I can use 
the same service templates for both since I haven't got a notification 
period defined in my service template..  The production server host 
template can notify 24x7, but the dev server host template is limitited 
to notifying during work hours.  The check period is 24x7 for both types 
of hosts, so Nagios always knows what's going on, even if it isn't 
saying anything about it.

Services can also inherit their contacts from their associated hosts, so 
my prod host template includes a pager contact group that my dev host 
template does not.


>      name     production_client_version
>      use      production_service,w_client_version          # Merge the 
> Production definition with the service command
> }
> 
> I keep getting an error when validating the configuration (nagios -v 
> nagios.cfg) that the w_client_version is a duplicate within the config 
> files and I have searched for it only finding it in one location.

I haven't tried referencing two templates in a definition before, so I 
can't tell you if that works or not.  My instinct is to try it with just 
one template and see if the error goes away.

> Can the check_command only be defined at the lowest level? Is this a 
> valid configuration or are there better examples of separating 
> development alerts from production alerts?

You can set the check_command in the service template and/or the service 
definition.  Anything you set in the service definition that's already 
been set in the service template will override the template's settings.

For example, I have an SSL-enabled site service template defined to use 
/ as its URL (my standard_service template has other things defined):

define service {
	use		standard_service
	name		SSL Site
	check_command	check_ssl_site!/
	notes		blah blah blah
	register	0
}

For a host where I want to check /, all I need is:

define service {
	use		SSL Site
	host_name	foo
}

But for a host where I want to check a different URL, I use:

define service {
	use		SSL Site
	host_name	different-foo
	check_command	check_ssl_site!/foo/bar/bat.asp
}

The second one is still inheriting everything except the check_command 
from the SSL Site template.

However, I think the answer to splitting up your dev and prod service 
types is just letting them inherit the notification period from the 
host.  You'll have half the service templates to manage if you can do that.

Look for "implied inheritance" on this page:
http://nagios.sourceforge.net/docs/3_0/objectinheritance.html

-- 
Chris Beattie

Nothing in this message is intended to make or accept and offer or to form a contract, except that an attachment that is an image of a contract bearing the signature of an officer of our company may be or become a contract. This message (including any attachments) is intended only for the use of the individual or entity to whom it is addressed. It may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, we hereby notify you that any use, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this message in error, please notify us immediately by telephone and delete this message immediately
 .

Thank you.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list