I’m trying to apply notifications for customer hosts to their respective user accounts. Each customer should only get notifications concerning their hosts.
Hosts and User aswell as Hostgroups and Usergroups are successfully imported via the Director Automation SQL import feature. The documentation/configuration mentions vars.notification[“mail”] on host objects to store the notification contact information in combination with notification apply rule using those variables. However, it seems not to be possible to set such an array value in custom variables at director import rule.
- I thought about exploding the notifications assoc array to individual variables like vars.notification_mail_users, vars.notification_mail_groups which I could set via import rule and modify the notification apply rule accordingly. Would this be a good solution?
results in vars[“notifications[“mail”]”] = …
result in vars[“notifications.mail”] = …
- Furthermore, to not have any configuration left in config files I also tried to recreate the notifications apply rule within Director. I’m not sure how i would reference host.vars.notification_mail_groups for user_groups field since Director forces me to select a usergroup object (same for user). How would I create such an apply rule within director or would it be okay to leave those inside config files?
Would it be possible to just have a notification apply rule matching up usergroups with hostgroups for example usergroup CompanyA with hostgroup CompanyA. Currently all users within a company are equivalent but may be seperated by roles in the future.
I was also thinking about importing notification apply rules like hosts/users creating all required rules but it seems to be only possible to import notificaton objects?
It would be awesome to hear how others would solve this.