alertmanager
alertmanager copied to clipboard
MSTeams integration message cards actions not supported
With the current state of the MSTeams integration we are not able to define actions next to the title, text and summary. Due to this it is not possible to define buttons that would, for example, provide a silence functionality or a URL to Prometheus, Alertmanager, Runbook or whatever.
https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#openuri-action
Environment
-
Alertmanager version: 0.26.0
insert output of
alertmanager --version
here (repeat for each alertmanager version in your cluster, if relevant to the issue) -
Prometheus version: 0.70.0
insert output of
prometheus --version
here (repeat for each prometheus version in your cluster, if relevant to the issue)
As a kind of workaround: We use html inside the text
to add a silence-link:
msteamsConfigs:
- text: |2-
{{ range $index, $alert := .Alerts }}
{{ if $index }}
<br />
{{ end }}
<hr style='border-color: #{{ if eq $.Status "resolved" }}2DC72D{{ else if eq $.Status "firing" }}{{ if eq $.CommonLabels.severity "critical" }}8C1A1A{{ else if eq $.CommonLabels.severity "error" }}FF4D00{{ else if eq $.CommonLabels.severity "warning" }}FFA500{{ else }}808080{{ end }}{{ else }}808080{{ end }}; border-width: 5px;' />
<strong>{{ $alert.Annotations.description }}</strong><br />
<br />
{{ range $key, $value := $alert.Annotations }}
{{- if and (ne $key "description") (ne $key "runbook_url") }}
<strong>{{ $key }}</strong> {{ $value }}<br />
{{ end -}}
{{ end -}}
{{- range $key, $value := $alert.Labels }}
{{- if ne $key "prometheus" }}
<strong>{{ $key }}</strong> {{ $value }}<br />
{{ end -}}
{{ end }}
{{ if eq $.Status "firing" -}}
<br />
<a href="{{ $.ExternalURL }}/#/silences/new?filter=%7B{{$c := 0}}{{ range $key, $value := $alert.Labels }}{{if $c}}%22%2C%20{{ end }}{{ $c = 1 }}{{ $key }}%3D%22{{ $value }}{{- end }}%22%7D" target='_blank'><button>Silence alert</button></a><br />
{{- end }}
{{ end }}
See https://github.com/prometheus/alertmanager/pull/3324#issuecomment-1537879727
Support for AdaptiveCards would be nice, maybe you can provide a merge request to implement that?