Multiple AlertManager outlets

21 views
Skip to first unread message

rs hpe

unread,
Jul 22, 2020, 1:11:35 PM7/22/20
to Prometheus Users
Hi, 

I am trying to configure alertmanager for Slack and Outlook. Individually, they work perfectly, but when I try both of them together in alertmanager.yml, I get an error. Here is the basic structure of my config:

global:

  resolve_timeout: 1m

  slack_api_url: *******

route:

  receiver: 'outlook-notification'

  receiver: 'slack-notification'

receivers:

- name: 'outlook-notification'

  email_configs:

  - to: *******

    from: *******

    smarthost: *******

    auth_username: *******

    auth_identity: *******

    auth_password: *******

    send_resolved: true

- name: 'slack-notification'

  slack_configs:

  - channel: '******'

  send_resolved: true

Brian Candler

unread,
Jul 22, 2020, 4:34:12 PM7/22/20
to Prometheus Users
That's the wrong way to combine them, because you can only have one default "receiver:" at any given level (it's invalid to have a YAML/JSON object with two identical keys).

Option 1: make a single named receiver which contains all the required destinations - it can contain both email_configs and slack_configs

global:

  resolve_timeout: 1m

  slack_api_url: *******

route:

  receiver: default-notification

receivers:

- name: default-notification

  email_configs:

  - to: *******

    from: *******

    smarthost: *******

    auth_username: *******

    auth_identity: *******

    auth_password: *******

    send_resolved: true

  slack_configs:

  - channel: '******'

    send_resolved: true


Option 2: set up routing rules to forward alerts to two separate receivers.


global:

  resolve_timeout: 1m

  slack_api_url: *******

route:

  receiver: null

  routes:

  - receiver: outlook-notification

    continue: true

  - receiver: slack-notification

    continue: true

receivers:

- name: null

- name: outlook-notification

  email_configs:

  - to: *******

    from: *******

    smarthost: *******

    auth_username: *******

    auth_identity: *******

    auth_password: *******

    send_resolved: true

- name: slack-notification

  slack_configs:

  - channel: '******'

    send_resolved: true


With option 2 as shown, there are no 'match' or 'match_re' clauses, so they always match.  However with some matching you can arrange for a subset of alerts to go to each recipient.

Reply all
Reply to author
Forward
0 new messages