0

I created an apply rule for notifications within an Icinga2 global zone:

  apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"

  user_groups = ["icingaadmins"]

  assign where host.vars.notification_type == "mail"
}

This works.

In my setup, there is a master and a satellite node, both with the notification feature enabled.

I now want to control which node sends out the notification manually without having to disable the notification feature on one of the nodes.

Is something like this possible? I tried many things (setting a zone, command_endpoint etc.), but none of them worked.

PythonLearner
  • 1,022
  • 2
  • 12
  • 29
  • 1
    Maybe you can add an extra variable that indicates if the host is allowed to send notifications or not and assign the notification only if the variable holds this value. You could then set the value to disabled on the satellite server and deploy the configuration. – inaki Apr 19 '17 at 09:49
  • Actually this is a great workaround. Thank you for suggesting it! +1 from me – PythonLearner Apr 19 '17 at 13:18
  • Hm... I just thought this through and I think it won't work. It will enable or disable notification for certain hosts, but it will not control if a satellite or master notifies. – PythonLearner Apr 19 '17 at 13:50
  • You are right I'm afraid... Another suggestion would be to look at the actual script sending the notifications, usually `SysconfDir + "/icinga2/scripts/mail-service-notification.sh"` and include an extra check? – inaki Apr 19 '17 at 14:54
  • Thanks for your other suggestion. I didn't mention in my question that I don't want to modify the notification scripts. However, I solved it in another way. All notifications are now thrown into a key-value-store and handled by another script. This works for me.. – PythonLearner May 02 '17 at 08:14

0 Answers0