'Why Alertmanager failed to send alerts to slack
I have created alerts, that fires and can be seen in Alertmanager. So previously I was able to get notifications to the Slack channel. I don't know what caused the issue, now unable to get notifications. I have gone through this Prometheus alert manager doesnt send alert k8s, but didn't find a way. Any help would be appreciated.
alertmanager.yaml
global:
slack_api_url: 'https://hooks.slack.com/services/some-dummy'
route:
group_by: [Alertname]
# Send all notifications to me.
receiver: 'slack notifications'
receivers:
- name: 'slack notifications'
slack_configs:
- channel: '#alerts'
text: "{{ .Annotations.summary }}\n{{ .Annotations.description }}\n{{ end }}"
Prometheus UI
Solution 1:[1]
remove the {{ end }}
, there mighte have been a {{ range .Alerts }} in the begining, but withot that, the {{ end }}
does not make sense.
Solution 2:[2]
receivers:
- name: 'default-receiver'
slack_configs:
- channel: 'alerts'
- title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
- text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jens Baitinger |
Solution 2 | yan |