Inheritance of variables when using host templates

Hi all,

we are using host templates as follows (SAP as an example for multihost systems):

  1. service template (might contain default values/thresholds for a service)
  2. generic SAP template: contains services and thresholds for all systems of that type (here: SAP systems), imports the service template
  3. system specific template (e.g. system ABC): might contain services and thresholds for this specific system (and all nodes belonging to that system). It imports the generic SAP template to get the defaults, if we don’t need specific values here.

But this is not working as expected. Because the private template imports the generic one, all values set in the private template are overwritten with the generic values, so the private template can not be used to change defaults, which have been set somewhere up in the tree. The only working option is to set the private values on host level, but this must be done on each host belonging to the system seperately.

Variable values will get effective as follows:

  1. Service template: values set here are effective, if nowhere else set (default value)
  2. generic SAP template: value is effective, if not set on host level (default value from service template can be overwritten here)
  3. SAP private template for system ABC: any value set here is ignored (overwritten by values of “generic SAP template”, regardless if that value was explicitly set there or inherited by service template)
  4. host level: value set here are effective always (overwriting all previous settings)

I understand, that the issue is caused by importing the generic template from private template. But is this really how it should work? Shouldn’t a template lower in the tree be able to overwrite previously set variables?
Is there another way to achieve what we intended to do? (We don’t want to create host groups for each SAP system…).

Thanks a lot.
Regards,
Dirk



Some system information:

icinga2 - The Icinga 2 network monitoring daemon (version: 2.13.1-1)

System information:
Platform: Red Hat Enterprise Linux Server
Platform version: 7.6 (Maipo)
Kernel: Linux
Kernel version: 3.10.0-957.12.1.el7.x86_64
Architecture: x86_64

Build information:
Compiler: GNU 4.8.5
Build host: runner-hh8q3bz2-project-507-concurrent-0
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017

Enabled features: api checker ido-mysql influxdb mainlog notification

Icinga Web 2 Version
2.7.3
Git commit
06cabfe8ba28cf545a42c92f25484383191a4e51
PHP Version
7.1.30
Git commit date
2019-10-18

Loaded modules

|Name|Version|
|businessprocess|2.1.0|
|director|1.7.2|
|doc|2.7.3|
|fileshipper|1.1.0|
|grafana|1.3.6|
|incubator|0.5.0|
|ipl|v0.5.0|
|monitoring|2.7.3|
|reactbundle|0.7.0|
|vsphere|1.1.0|

Hello Dirk!

What about importing templates not in templates but only in objects instead, in desired order?

Best,
A/K

Hi A/K,

thanks for your suggestion, I think it should work, if we assign the “generic SAP template” and the “private template” to each host separately (if the private template does not import the generic one anymore).

Would still be nice, if the “template tree” would work as one would expect…

Thanks again.
Regards,
Dirk