I have to send different alerts in 20 Slack channels based on some filter. My Alertmanager config file looks like (only two receiver as example):
global:
resolve_timeout: 1m
slack_api_url: '<slack_api_url>'
templates:
- 'slack_alert.tmpl'
route:
receiver: 'slack-admin'
routes:
- receiver: 'slack-ch1'
matchers:
- machine_group =~ ".*something1.*"
continue: true
receivers:
- name: 'slack-admin'
slack_configs:
- channel: '#slack-admin'
send_resolved: true
icon_url: https://avatars3.githubusercontent.com/u/3380462
title: '{{ template "slack.slack_alert.title" .}}'
text: '{{ template "slack.slack_alert.text" .}}'
- name: 'slack-ch1'
slack_configs:
- channel: '#slack-ch1'
send_resolved: true
icon_url: https://avatars3.githubusercontent.com/u/3380462
title: '{{ template "slack.slack_alert.title" .}}'
text: '{{ template "slack.slack_alert.text" .}}'
Is there any way to declare following block of code as global variable without tasting to al 20 channels?
send_resolved: true
icon_url: https://avatars3.githubusercontent.com/u/3380462
title: '{{ template "slack.slack_alert.title" .}}'
text: '{{ template "slack.slack_alert.text" .}}'
Slack alert template is in Go templating form. Is it possible to integrate it with template?