Service Template Inheritance

Ken Netzorg knetzorg at gmail.com
Mon Mar 23 18:36:12 CET 2009


Chris,
Thanks for the detailed info. I had gone through the inheritance
documentation you'd listed below, but I didn't put the facts together that I
can mix my host template with my service template such that I can have a
host's notification settings apply to a service. I had been trying to figure
out how to merge the two since I want the service checks associated with my
development hosts to take on the host notifications. I'll have to go back
and re-evaluate this and see if I can get this working. If so, I agree, it
will cut down on the number of templates and areas I have to define
notifications.

Ken

On Mon, Mar 23, 2009 at 1:27 PM, Chris Beattie <cbeattie at geninfo.com> wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090323/1517c6be/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
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