Custom variable precedence. Not working?

I’m having a problem with the precedence of custom variables. I have an apply rule to check for space in windows drives defined in a array with predefined thresholds.

apply Service for (config in host.vars.wdrive) {

name = "Disk " + config + ":"

import "st_windisk_snmp"

icon_image = "harddisk.png"

assign where host.vars.snmp && match("w*", host.vars.OS)

vars.critical = "98"

vars.path = config

vars.warning = "95"

import DirectorOverrideTemplate


I have created a new host which I (meaning the user) want to have different thresholds so I set the “critical” and “warning” custom vars to 92 and 90 (instead of 98 / 95) in the host itself.

object Host "TRUE_HOST.TRUE.DOMAIN." {

import "Standard-Host"

import "Windows_Server"

display_name = "TRUE_HOST"

address = ""

notes = "Pizza Server"

groups = [ "pizzas" ]

vars.OS = "w2019"

vars.critical = "92"

vars.host_type = "virt"

vars.location = "par" = [ "A Real Service", "Another Real Service" ]

vars.snmp = true

vars.warning = "90"

vars.wdrive = [ "D", "E" ]


After deploying the configuration I still got the same thresholds on the check instead of the ones defined at host level. The inspect check shows:

‘/path/here/’ ‘10. 10.10.10’ ‘public’ ‘95’ ‘98’ ‘E’

I thought that variables defined at the host level took precedence over variables defined anywhere else. Isn’t that so?

Program Version	2.11.3-1
Icinga web 2.8.2
PHP Version 7.3.11
director 1.7.2

No surprise it was my faulty understanding of what the heck is going on with custom variables, findings below (may still be wrong but are working):

If you setup values in the apply rule they take precedence and that’s it. So the fix:

  • Leave empty values in Service rule (inherited values are OK)
  • Set what used to be the default values of the Apply rule in the appropiate Host Template
  • Override the host template defaults in the host/s you need to have diffferent check values.

That works. Perhaps some troubled soul in the future will find it helpful.