Config - Problem with CustomVar translation in users object

hello guys,

in my icinga2 config, i found an error for translation a custom var “vars.s3_notify_email”:

object Host "silver01" {
    ...
    vars.hostgroup = "dva"
    vars.type = "s3"
    vars.s3_product = "silver"
    vars.s3_username = "dva002"
    vars.s3_notify_email = "xxx.yyyy@web.de"
}

the apply notification rule:

apply Notification "s3-notification" to Service {
    import "mail-service-notification"
    users = [ "s3-user" ]
    vars.notify_email = "$host.vars.s3_notify_email$"
    vars.extra = [host.vars.s3_product,host.vars.s3_username,host.vars.s3_notify_email]
    assign where host.vars.type == "s3" && service.name == "s3_quota"

}

the user-object is my problem. The customVar need the value from each host object. looks like xxx.yyyy@web.de.But in icingaweb2, the content from customVar is host.vars.s3_notify_email.

object User "s3-user" {
    display_name = "S3 Notification"
    email = "$host.vars.s3_notify_email$"

}

What am I doing wrong? Should i use a dictionary for this case?

regars
sascha

That syntax is invalid, you cannot reference host attributes from the user object. For Icinga 2, this is just a string then, no macro resolver involved.

Also the following is syntactically incorrect …

… you just need to write it like this:

vars.notify_email = host.vars.s3_notify_email

With using notify_email in your NotificationCommand, you’re fine then.

Cheers,
Michael