nisabek / icinga2-slack-notifications

Icinga2 notification integration with slack
Apache License 2.0
71 stars 36 forks source link

overrides do not work #40

Open flybyray opened 2 years ago

flybyray commented 2 years ago

I use the director configuration approach. A badhost!slack-notifications-notification-hosts will be generated. But my channel configuration #ops-on-call will be overriden by the default #monitoring_alerts.

Relevant output icinga2 object list --name 'badhost!slack-notifications-notification-hosts'

  % declared in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 57:1-57:67
  * __name = "badhost!slack-notifications-notification-hosts"
...
  * templates = [ "slack-notifications-notification-hosts", "slack-notifications-user-configuration-hosts", "slack-notifications-default-configuration-hosts", "slack-notifications-configuration", "slack-notifications-user-configuration", "slack-notifications-default-configuration" ]
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 57:1-57:67
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-user-configuration.conf', lines 8:1-8:68
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 51:1-51:71
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 39:1-39:57
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-user-configuration.conf', lines 1:0-1:61
    % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 1:0-1:64
...
    * slack_notifications_channel = "#monitoring_alerts"
      % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-user-configuration.conf', lines 11:5-11:53
      % = modified in '/etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf', lines 60:3-60:57
...

I guess the last one will override.

The following can be found on the relevant lines/

tail -n +11 < /etc/icinga2/zones.d/global-templates/slack-notifications-user-configuration.conf | head -n 1

    vars.slack_notifications_channel = "#ops-on-call"

Defined in template slack-notifications-user-configuration-hosts

tail -n +60 < /etc/icinga2/zones.d/global-templates/slack-notifications-configuration.conf | head -n 1

  vars.slack_notifications_channel = "#monitoring_alerts"

Defined in template slack-notifications-notification-hosts