Reputation: 1
I'm trying to migrate Prometheus Alertmanager alerting from using slack_configs
(ref1) into the webex_configs
(ref2). Is there any possibility to adjust the message sent to Webex with structure used in "old" slack_configs? Following structure is needed:
<Title composed of .Status + text eg 'Event Notification'>
Alert - < Annotations.Summary + Labes.severity >
Message - < Annotations.message >
Graph - < GeneralURL >, Dashboard < Annotations.dashboardurl >
Details ( composed of Labels.SortedPairs (Name + Value))
I know this is possible via webhook_configs
+ proxy, however If there's possibility to create this without the need of proxy, that would be ideal.
- ref1
- name: alerts
slack_configs:
- api_url: https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
channel: '#XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
http_config:
proxy_url: XXXXXXXXXXX
text: |-
{{ `{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - {{ .Labels.severity }}
*Message:* {{ .Annotations.message }}
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Dashboard:* <{{ .Annotations.dashboardurl }}|:bar_chart:>
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* {{ .Value }}
{{ end }}
{{ end }}` }}
title: |-
{{ `[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Notification` }}
- ref2
- name: alerts_webex
webex_configs:
- api_url: 'https://webexapis.com/v1/messages'
room_id: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
send_resolved: false
http_config:
proxy_url: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
authorization:
type: 'Bearer'
credentials: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
message: |-
{{ `{{ range .Alerts }}
"**{{ .Status }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }} Notification**\n\n*Severity:* {{ .Labels.severity }}\n**Alert:** {{ .Annotations.summary }}\n**Message:** {{ .Annotations.message }}\n**Graph:** [Graph URL]({{ .GeneratorURL }})\n**Dashboard:** [Dashboard URL]({{ .Annotations.dashboardurl }})\n**Details:**\n{{ range .Labels.SortedPairs }} • **{{ .Name }}:** {{ .Value }}\n{{ end }}"
{{ end }}` }}
Note: Alerts from webex_configs
don't arrive at any point, without any errors produced & connection working fine. slack_configs
fully functional, even when using both configurations together with routes & continue: true
for receivers, only slack receives the alert.
Upvotes: 0
Views: 61