HOST VS TEMPLATE settings when configuring checks

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

HOST VS TEMPLATE settings when configuring checks

Post by dlukinski »

Hello XI support

Which settings would take precedence when configuring templates as follows:

Host template (contains contact group, monitoring and notification frequencies) / group of hosts has one configured instead of default template 1:1 (every host has applicable template set by-host)

Service template (same monitoring and notification frequencies, sometimes different from those specified in host) 1:1 to various service checks

Now we have hosts added to service checks (where host subjected to one template and service check to another template

- How to make this right?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: HOST VS TEMPLATE settings when configuring checks

Post by lmiltchev »

Using multiple layers of templates could get tricky. In general, the host templates are applied to hosts, the service templates - to services. If you had the same directive added to multiple templates (that are added to a host/service), nagios would use the value defined in the first template. You may have "Cancelling, Additive or Implied Inheritance"... Also, local variables would always override the ones in templates. So, without looking at a specific example, it is hard to say what template would take precedence.

For more information, please review our documentation on Object Inheritance here:
https://assets.nagios.com/downloads/nag ... tance.html

Tip: When in doubt, you can always review the host/service configs in the objects.cache to see what directives are being used.

Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: HOST VS TEMPLATE settings when configuring checks

Post by dlukinski »

lmiltchev wrote:Using multiple layers of templates could get tricky. In general, the host templates are applied to hosts, the service templates - to services. If you had the same directive added to multiple templates (that are added to a host/service), nagios would use the value defined in the first template. You may have "Cancelling, Additive or Implied Inheritance"... Also, local variables would always override the ones in templates. So, without looking at a specific example, it is hard to say what template would take precedence.

For more information, please review our documentation on Object Inheritance here:
https://assets.nagios.com/downloads/nag ... tance.html

Tip: When in doubt, you can always review the host/service configs in the objects.cache to see what directives are being used.

Hope this helps.
How to get to object.cache ?

I check HOSTS via ICMP or HTTP (more frequent, to avoid over-notification in the event of failure) - something you suggested few month ago when I asked
Now, services are countless and done against many hosts, so attempted using templates by service type to be able to change configurations quickly and segregate DEV / PROD service check frequencies and notifications

How can I do that?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: HOST VS TEMPLATE settings when configuring checks

Post by hsmith »

dlukinski wrote:How to get to object.cache ?

Code: Select all

vi /usr/local/nagios/var/objects.cache
dlukinski wrote:I check HOSTS via ICMP or HTTP (more frequent, to avoid over-notification in the event of failure) - something you suggested few month ago when I asked
Now, services are countless and done against many hosts, so attempted using templates by service type to be able to change configurations quickly and segregate DEV / PROD service check frequencies and notifications
I don't fully understand this question. Are you asking how to change something quickly? I'd have multiple templates for multiple purposes and change the template as need be.
Former Nagios Employee.
me.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: HOST VS TEMPLATE settings when configuring checks

Post by dlukinski »

hsmith wrote:
dlukinski wrote:How to get to object.cache ?

Code: Select all

vi /usr/local/nagios/var/objects.cache
dlukinski wrote:I check HOSTS via ICMP or HTTP (more frequent, to avoid over-notification in the event of failure) - something you suggested few month ago when I asked
Now, services are countless and done against many hosts, so attempted using templates by service type to be able to change configurations quickly and segregate DEV / PROD service check frequencies and notifications
I don't fully understand this question. Are you asking how to change something quickly? I'd have multiple templates for multiple purposes and change the template as need be.
--------------------------------------------
NO I asked which template host or service would take precedence imposing monitoring and notification frequency (both of them having different numbers)
- IF we cannot answer this question, should we "hardcode" host monitoring and notification frequency and keep services under templates?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: HOST VS TEMPLATE settings when configuring checks

Post by ssax »

If it's a service, the service template would take priority. If it's a host, the host template would take priority.

The service would only inherit the hosts settings (certain ones) if it didn't have those defined. See the implied inheritance section here:

https://assets.nagios.com/downloads/nag ... tance.html
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: HOST VS TEMPLATE settings when configuring checks

Post by dlukinski »

ssax wrote:If it's a service, the service template would take priority. If it's a host, the host template would take priority.

The service would only inherit the hosts settings (certain ones) if it didn't have those defined. See the implied inheritance section here:

https://assets.nagios.com/downloads/nag ... tance.html
Thank you, This answers my question.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: HOST VS TEMPLATE settings when configuring checks

Post by mcapra »

Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: HOST VS TEMPLATE settings when configuring checks

Post by dlukinski »

mcapra wrote:Is it alright if we lock this thread and mark the issue as resolved?
Yes please and thank you
Locked