I want to set up Prometheus' Alertmanager so that when I get an alert, I check its severity. If it is "warning", I want to send the alert to the "warning" Slack channel. If it is "critical", send it to the "critical" Slack channel. How do I specify this in the alertmanager.yml?
You can do so by configuring matchers in route:
route:
receiver: 'slack-notifications-criticals'
routes:
- matchers:
- severity = "warning"
receiver: 'slack-notifications-warnings'
- matchers:
- severity = "critical"
receiver: 'slack-notifications-criticals'
And configuring recievers slack-notifications-warnings
and slack-notifications-criticals
with corresponding slack channels.
Example of full configuration with different recipients depending on severity can be found here.