{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/alertmanager/issues/1476","repository_url":"https://api.github.com/repos/prometheus/alertmanager","labels_url":"https://api.github.com/repos/prometheus/alertmanager/issues/1476/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/alertmanager/issues/1476/comments","events_url":"https://api.github.com/repos/prometheus/alertmanager/issues/1476/events","html_url":"https://github.com/prometheus/alertmanager/issues/1476","id":343628042,"node_id":"MDU6SXNzdWUzNDM2MjgwNDI=","number":1476,"title":"Unable to send messages based on labels to two receivers","user":{"login":"kahootali","id":13013437,"node_id":"MDQ6VXNlcjEzMDEzNDM3","avatar_url":"https://avatars3.githubusercontent.com/u/13013437?v=4","gravatar_id":"","url":"https://api.github.com/users/kahootali","html_url":"https://github.com/kahootali","followers_url":"https://api.github.com/users/kahootali/followers","following_url":"https://api.github.com/users/kahootali/following{/other_user}","gists_url":"https://api.github.com/users/kahootali/gists{/gist_id}","starred_url":"https://api.github.com/users/kahootali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahootali/subscriptions","organizations_url":"https://api.github.com/users/kahootali/orgs","repos_url":"https://api.github.com/users/kahootali/repos","events_url":"https://api.github.com/users/kahootali/events{/privacy}","received_events_url":"https://api.github.com/users/kahootali/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-23T13:15:01Z","updated_at":"2018-07-23T13:36:19Z","closed_at":"2018-07-23T13:36:19Z","author_association":"NONE","body":"I want to send different notifications on multiple slack channels based on the labels of the pod e.g. if my pod has `env: dev` then it should send notifications to one channel else the prod one. I know we can send alerts based on the labels on alerts as below but can we send alerts based on labels of pods:\r\n```\r\nglobal:\r\n\r\n  resolve_timeout: 5m\r\n\r\ntemplates:\r\n\r\n- '/etc/alertmanager/template/*.tmpl'\r\n\r\nroute:\r\n\r\n  group_by: ['alertname', 'cluster', 'service']\r\n\r\n  group_wait: 30s\r\n\r\n  group_interval: 5m\r\n\r\n  repeat_interval: 1h\r\n\r\n  receiver: 'default-receiver'\r\n\r\n  routes:\r\n\r\n  - match:\r\n\r\n      \"env\": \"production\"\r\n\r\n    receiver: 'alerts-production'\r\n\r\n  - match:\r\n\r\n      alertname: DeadMansSwitch\r\n\r\n    receiver: 'null'\r\n\r\n  - match:\r\n\r\n      \"env\": \"development\"\r\n\r\n    receiver: 'alerts-development'\r\n\r\ninhibit_rules:\r\n\r\n- source_match:\r\n\r\n    severity: 'critical'\r\n\r\n  target_match:\r\n\r\n    severity: 'warning'\r\n\r\n  # Apply inhibition if the alertname is the same.\r\n\r\n  equal: ['alertname', 'cluster', 'service']\r\n\r\nreceivers:\r\n\r\n- name: 'alerts-development'\r\n\r\n  slack_configs:\r\n\r\n  - api_url: ''\r\n\r\n    channel: '#dev'\r\n\r\n    title: '[{{ .Status | toUpper }}{{ if eq .Status \"firing\" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification'\r\n\r\n    text: >-\r\n\r\n        {{ range .Alerts }}\r\n\r\n           *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`\r\n\r\n          *Description:* {{ .Annotations.description }}\r\n\r\n          *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>\r\n\r\n          *Details:*\r\n\r\n          {{ range .Labels.SortedPairs }} *{{ .Name }}:* `{{ .Value }}`\r\n\r\n          {{ end }}\r\n\r\n        {{ end }}\r\n\r\n    send_resolved: true\r\n\r\n- name: 'alerts-production'\r\n\r\n  slack_configs:\r\n\r\n  - api_url: ''\r\n\r\n    channel: '#prod'\r\n\r\n    title: '[{{ .Status | toUpper }}{{ if eq .Status \"firing\" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification'\r\n\r\n    text: >-\r\n\r\n        {{ range .Alerts }}\r\n\r\n           *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`\r\n\r\n          *Description:* {{ .Annotations.description }}\r\n\r\n          *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>\r\n\r\n          *Details:*\r\n\r\n          {{ range .Labels.SortedPairs }} *{{ .Name }}:* `{{ .Value }}`\r\n\r\n          {{ end }}\r\n\r\n        {{ end }}\r\n\r\n    send_resolved: true\r\n\r\n- name: 'default-receiver'\r\n\r\n  slack_configs:\r\n\r\n  - api_url: ''\r\n  \r\n    channel: ''\r\n\r\n    title: '[{{ .Status | toUpper }}{{ if eq .Status \"firing\" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification'\r\n\r\n    text: >-\r\n\r\n        {{ range .Alerts }}\r\n\r\n           *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`\r\n\r\n          *Description:* {{ .Annotations.description }}\r\n\r\n          *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>\r\n\r\n          *Details:*\r\n\r\n          {{ range .Labels.SortedPairs }} *{{ .Name }}:* `{{ .Value }}`\r\n\r\n          {{ end }}\r\n\r\n        {{ end }}\r\n\r\n    send_resolved: true\r\n\r\n- name: 'null'\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/prometheus/alertmanager/issues/comments/407060176","html_url":"https://github.com/prometheus/alertmanager/issues/1476#issuecomment-407060176","issue_url":"https://api.github.com/repos/prometheus/alertmanager/issues/1476","id":407060176,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzA2MDE3Ng==","user":{"login":"simonpasquier","id":2587585,"node_id":"MDQ6VXNlcjI1ODc1ODU=","avatar_url":"https://avatars1.githubusercontent.com/u/2587585?v=4","gravatar_id":"","url":"https://api.github.com/users/simonpasquier","html_url":"https://github.com/simonpasquier","followers_url":"https://api.github.com/users/simonpasquier/followers","following_url":"https://api.github.com/users/simonpasquier/following{/other_user}","gists_url":"https://api.github.com/users/simonpasquier/gists{/gist_id}","starred_url":"https://api.github.com/users/simonpasquier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonpasquier/subscriptions","organizations_url":"https://api.github.com/users/simonpasquier/orgs","repos_url":"https://api.github.com/users/simonpasquier/repos","events_url":"https://api.github.com/users/simonpasquier/events{/privacy}","received_events_url":"https://api.github.com/users/simonpasquier/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T13:36:19Z","updated_at":"2018-07-23T13:36:19Z","author_association":"CONTRIBUTOR","body":"I've replied to your email on the Prometheus mailing list. I'm closing the issue for now. Will reopen if we find that there is a real bug."}}
{"actor":{"display_login":"simonpasquier"}}