# Variable override/precedence for service objects

**URL:** <https://community.icinga.com/t/variable-override-precedence-for-service-objects/4727>\
**Category:** Icinga 2\
**Tags:** icingaweb2, icinga2\
**Created:** [June 19, 2020, 2:42pm UTC](https://community.icinga.com/t/variable-override-precedence-for-service-objects/4727 "2020-06-19T14:42:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJ-LAMARC](https://community.icinga.com/user_avatar/community.icinga.com/mj-lamarc/32/2716_2.png) [@MJ-LAMARC](https://community.icinga.com/u/MJ-LAMARC)\
**Post date:** [June 19, 2020, 2:42pm UTC](https://community.icinga.com/t/variable-override-precedence-for-service-objects/4727/1 "2020-06-19T14:42:50Z")

</div>

Hi All,  
I came across an unexpected behaviour when working with the load-Service, and I adapted the cload/wload parameters.

Btw. Version is: icinga2-bin-2.11.3-1.el7.icinga.x86\_64

1. conf.d/services.conf - unmodified

2. the host definition is:

using the following templates:

```
# cat zones.d/global-templates/templates.conf 
template Host "MY-host" {
    import "generic-host"

    vars.client_endpoint = name
    vars += {
        os = "Linux"
        MY = true
        noswap = true

        notification["mail"] = {
            groups = ["icingaadmins"]
            users = ["icingaadmin"]
        }

        disks["disk /"] = { disk_partitions = "/" }
        disks["disk /boot"] = { disk_partitions = "/boot" }
        disks["disk /opt"] = { disk_partitions = "/opt" }

        ipmi_address = "localhost"
        ipmi_protocal_lan_version = "OPENIPMI"
        ipmi_config_file = "/etc/icinga2/conf.d/ipmi.cfg"
        ipmi_sensor_type = "Temperature,Voltage,Fan,Power_Supply"

        load_wload1 = 7.0
        load_wload5 = 6.0
        load_wload15 = 4.0
        load_cload1 = 15.0
        load_cload5 = 8.0
        load_cload15 = 6.0
        load_percpu = "true"
    }
}

template Host "small-host" {
    import "MY-host"
  
    vars += {
        laitype = "small"

        procs_warning = 1000
        procs_critical = 2000
    }
}

```

1. /usr/share/icinga2/include/command-plugins.conf - unchanged

As I understand then override/precedence sequence is: Service -\> Host -\> CheckCommand. So my setting in the host definition of cload/wload (via the templates) will override the definition in CheckCommand.

**But** , in icingaweb2 I have a kind of flipping in soft-states.  
One minute the values from CheckCommand definition are shown, service goes red, and the next minute the correct values of the Host definition are shown, service goes green.

Questions are:  
Am I doing something completely wrong? I’m sure it worked some time before…  
Is the problem related to Icinga2-Core or to Iciningaweb2 ?

Any help appreciated.  
Kind regards  
Marcus
