Runtime macro evaluation order

According to Monitoring Basics - Icinga 2 v2.10 there should be a way to set some sort of “global default” for runtime macros. If not explicitly set in either service, host or command object, it should get sourced from “5. Global custom attributes in the Vars constant”

I seem to fail to understand how that works.

my check_command:

object CheckCommand “check_snmp_oid” {
import “plugin-check-command”
command = [ PluginDir + “/check_snmp” ]

arguments = {
“-H” = “$address$”
“-p” = “$port$”
“-C” = “$snmpcommunity$”

}

I also have a 00_constants.conf

const snmpcommunity = “public”

and 01_globals.conf

globals.vars += { snmpcommunity = “public” }
globals.Vars += { snmpcommunity = “public” }
Vars += { snmpcommunity = “public” }

Files get included properly, syntax errors in them will throw exceptions in the config parser

but debuglog still shows that the resulting command is missing the ‘-C public’ argument

Where’s my mistake?

Found a workaround, but not necessarily a solution.

00_default_snmp_values.conf

template CheckCommand “default-snmp-values” {
vars += {
snmpcommunity = “public”

}
}

and then adding

import “default-snmp-values”

as last statement of the CheckCommand object seems to work. But I was hoping to avoid the import, because then I could not possibly forget it on future CheckCommand ideas