Icinga Director Apply Rule with Dictionary

Hello to All,

how can I set this Apply Rule in the Director

apply Notification “mail-service-notification” to Service {
command = “mail_service_notification”

interval = 0

if (service.vars.notification.MAIL.users) {
users = service.vars.notification.MAIL.users
} else if (host.vars.notification.MAIL.users) {
users = host.vars.notification.MAIL.users
}

if (service.vars.notification.MAIL.groups) {
user_groups = service.vars.notification.MAIL.groups
} else if (host.vars.notification.MAIL.groups) {
user_groups = host.vars.notification.MAIL.groups
}

assign where ( host.vars.notification.MAIL && typeof(host.vars.notification.MAIL) == Dictionary ) || ( service.vars.notification.MAIL && typeof(service.vars.notification.MAIL) == Dictionary )

}

Thanks for your help

Hi,

I think in this way it’s not possible. Because there are no if options. So you have to split this rule in many ones and work with the apply options.

Other ideas I don’t have. Maybe other users.