Skip to content

Feature Request: Control execution of notifications by their 'zone' attribute #5398

@peteeckel

Description

@peteeckel

I'd like to suggest a feature making it possible to control which machines or master/satellite clusters execute a particular notification.

Simplified use case:

A master cluster in one location and a satellite cluster in a remote location. Checks for the remote location are controlled by agents and the satellite cluster in the remote location, while the master cluster handles all services in the main location. Different notification facilities exist for each location, which are for not open for access from the respective other location - i.e. Notification Mechanism 1 can only be used from the main location, while notification mechanism 2 is specific to the remote location.

The most elegant solution to this problem IMHO would be to provide two notifications, one of which is applied in the master zone and the other in the satellite zone:

/etc/icinga2/zones.d/master/notifications.conf:

apply Notification "master-notification" to Service {
    import "mail-service-notification"
    command = "notification-method1"
    user_groups =  service.vars.notification.master.groups
    assign where host.zone == "master"
}

/etc/icinga2/zones.d/satellite/notifications.conf:

apply Notification "satellite-notification" to Service {
    import "mail-service-notification"
    command = "notification-method2"
    user_groups =  service.vars.notification.satellite.groups
    assign where host.zone == "satellite"
}

I tried quite exactly that (apart from zone names), and it seems despite the notifications showing up properly:

Object 'master1.example.com!disk!test-master-service-notification' of type 'Notification':
Object 'master1.example.com!load!test-master-service-notification' of type 'Notification':
Object 'master1.example.com!memory!test-master-service-notification' of type 'Notification':
Object 'master2.example.com!disk!test-master-service-notification' of type 'Notification':
Object 'master2.example.com!load!test-master-service-notification' of type 'Notification':
Object 'master2.example.com!memory!test-master-service-notification' of type 'Notification':
...
Object 'satellite1.example.com!disk!test-satellite-service-notification' of type 'Notification':
Object 'satellite1.example.com!load!test-satellite-service-notification' of type 'Notification':
Object 'satellite1.example.com!memory!test-satellite-service-notification' of type 'Notification':
Object 'satellite2.example.com!disk!test-satellite-service-notification' of type 'Notification':
Object 'satellite2.example.com!load!test-satellite-service-notification' of type 'Notification':
Object 'satellite2.example.com!memory!test-satellite-service-notification' of type 'Notification':
...

Object 'master1.example.com!memory!test-master-service-notification' of type 'Notification':
  % declared in '/etc/icinga2/zones.d/master/notifications.conf', lines 19:1-19:63
  ...
  * zone = "master"
    % = modified in '/etc/icinga2/zones.d/master/notifications.conf', lines 19:1-19:63

Object 'satellite1.example.com!memory!test-satellite-service-notification' of type 'Notification':
  % declared in '/etc/icinga2/zones.d/satellite/notifications.conf', lines 19:1-19:63
  ...
  * zone = "satellite"
    % = modified in '/etc/icinga2/zones.d/satellite/notifications.conf', lines 19:1-19:63

Still the notifications for the satellites and the connected agents are often (not always, which makes it pretty vexing) executed on the master nodes even though notifications on the satellites are enabled.

My suggestion is to modify the behaviour of notifications defined for a given zone (as reflected by the 'zone' attribute of the notification object) on the notification hosts in that zone and in that zone only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/distributedDistributed monitoring (master, satellites, clients)area/notificationsNotification eventsenhancementNew feature or requeststalledBlocked or not relevant yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions