Skip to content
Snippets Groups Projects
Verified Commit c61b41c3 authored by Quentin Duchemin's avatar Quentin Duchemin
Browse files

Slack buttons are not compatible anymore with Mattermost, use fields

parent f64d3e57
No related branches found
No related tags found
1 merge request!65Add alerting
...@@ -46,29 +46,29 @@ inhibit_rules: ...@@ -46,29 +46,29 @@ inhibit_rules:
receivers: receivers:
- name: 'mattermost' - name: 'mattermost'
slack_configs: slack_configs:
- channel: '$MATTERMOST_CHANNEL' - channel: '$MATTERMOST_CHANNEL'
icon_emoji: ":thaenkin:" icon_emoji: ":thaenkin:"
username: "AlertManager" username: "AlertManager"
color: '{{ if eq .CommonLabels.severity "warning" -}}warning{{- else if eq .CommonLabels.severity "critical" -}}danger{{- end -}}' color: '{{ if eq .CommonLabels.severity "warning" -}}warning{{- else if eq .CommonLabels.severity "critical" -}}danger{{- end -}}'
title: "### {{ .CommonLabels.alertname }}" title: "{{ .CommonLabels.alertname }}"
text: "Summary : {{ .CommonAnnotations.summary }}" text: "**{{ .CommonLabels.severity }}** : {{ .CommonAnnotations.summary }}"
fields: fields:
- title: "Description" - title: "Description"
value: "{{ .CommonAnnotations.description }}" value: "{{ .CommonAnnotations.description }}"
- title: "Criticity" # Would be better with buttons but Slack new buttons are not
value: "{{ .CommonLabels.severity }}" # yet compatible with Mattermost interactive messages model
actions: - title: ":chart_with_upwards_trend: See the data"
- type: button value: "[Open Grafana]({{ (index .Alerts 0).Annotations.dashboard }})"
text: ':chart_with_upwards_trend: See dashboard' short: true
url: '{{ (index .Alerts 0).Annotations.dashboard }}' - title: ':no_bell: Silence'
style: primary value: '[Silence the alert]({{ template "__alert_silence_link" . }})'
- type: button short: true
text: ':no_bell: Silence' - title: ':question: Documentation'
url: '{{ template "__alert_silence_link" . }}' value: "[Show documentation](https://wiki.picasoft.net/doku.php?id=technique:adminsys:monitoring:metrologie:stack-picasoft)"
style: danger short: true
- type: button - title: ':fire: See all alerts'
text: ':grey_question: Documentation' value: "[AlertManager WebUI](https://alertmanager.picasoft.net)"
url: "https://wiki.picasoft.net/doku.php?id=technique:adminsys:monitoring:metrologie:stack-picasoft" short: true
templates: templates:
- templates.tpl - /config/templates.tpl
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
{{ .ExternalURL }}/#/silences/new?filter=%7B {{ .ExternalURL }}/#/silences/new?filter=%7B
{{- range .CommonLabels.SortedPairs -}} {{- range .CommonLabels.SortedPairs -}}
{{- if ne .Name "alertname" -}} {{- if ne .Name "alertname" -}}
{{- .Name }}%3D"{{- .Value -}}"%2C%20 {{- .Name }}%3D'{{- .Value -}}'%2C%20
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
alertname%3D"{{ .CommonLabels.alertname }}"%7D alertname%3D'{{ .CommonLabels.alertname }}'%7D
{{- end }} {{- end }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment