over writing services from templates

mail at catsnest.co.uk mail at catsnest.co.uk
Mon May 9 12:57:09 CEST 2011


Hi all,


I seem to have a working solution but an confused as to why it works,
could some one please explain or suggest a better way to do this.


I apply service to hosts via, host-templates and wanted to change a
value for a service but just for one hosts.
I didnt want to add a new service / service template hoping i could
just over ride the value for just that one host:
I am running Nagios 3.2.3 and the simplified config looks like this:



service {
     name                              service-check
     command                       run-some-check.sh
     max_check_attempts      1
     hostgroup_name              host_group1
}

host {
        name                           host-template1
        use                              generic
        hostgroups                  +host_group1
        register                        0
}


host {
        name                           host1
        use                              host-template1
        }

host {
        name                           host2
        use                              host-template1
        }

Now I wanted to change the value for max_check_attempts  used by the
service for host2.

What I did was

service {
     name                              service-check
     command                       run-some-check.sh
     max_check_attempts      3
    host                                  host2
}

This created duplicate a warning when doing a verbose config check,
but no warning on the normal config check and it allowed Nagios to
reload and used the values from the host defined service!

My questions are,
   why does this work?
   Is Nagios actually running both services but only showing one of
them in the gui and ill probably have some race condition between
them.
   Is there a better way to do this?

Thanks for your help,
Ritchie
--
Fnord...
<-- http://23.me.uk --> <-- http://wiki.s23.org --> <--
http://twitter.com/23me -->
<- -Only the lavender prairie dogs know the key to unlock the secret
of the tumble-weeds. -->

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
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