Hi,
I'm trying to add button to my Slack alert but I'm entirely sure how can I
do this. Here is my test configuration:
alertmanagerFiles:
alertmanager.yml:
global:
resolve_timeout: 30m
receivers:
- name: slack_webhook
slack_configs:
- channel: '#test'
send_resolved: true
api_url: https://hooks.slack.com/services/xyz
username: Alertmanager
title: |-
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{
.Alerts.Firing | len }}{{ end }}{{ range .Alerts.Resolved }}{{ end }}] {{
.CommonLabels.alertname }}
text: >-
*Alert details*:
{{ range .Alerts -}}
*Alert:* {{ .Annotations.summary }}{{ if .Labels.severity }} -
`{{ .Labels.severity }}`{{ end }}
*Description:* {{ .Annotations.description }}
*Details:*
{{ if .Labels.alertname }} *{{ .Labels.alertname }}*{{"\n"}}{{
end }}
{{- if .Labels.severity }} • Severity: `{{ .Labels.severity
}}`{{"\n"}}{{ end }}
{{- if .Labels.instance }} • Instance: `{{ .Labels.instance
}}`{{"\n"}}{{ end }}
{{- if .Labels.node }} • Node: `{{ .Labels.node }}`{{"\n"}}{{
end }}
{{- if .Labels.pod }} • Pod: `{{ .Labels.pod }}`{{"\n"}}{{ end }}
{{- if .Labels.namespace }} • Namespace: `{{ .Labels.namespace
}}`{{"\n"}}{{ end }}
{{- if .Labels.container }} • Container: `{{ .Labels.container
}}`{{"\n"}}{{ end }}
{{- if .Labels.job_name }} • Job: `{{ .Labels.job_name
}}`{{"\n"}}{{ end }}
{{- if .Labels.persistentvolumeclaim }} • PVC: `{{
.Labels.persistentvolumeclaim }}`{{"\n"}}{{ end }}
{{- if .Labels.persistentvolume }} • PV: `{{
.Labels.persistentvolume }}`{{"\n"}}{{ end }}
{{- end }}
{{- if gt (len .Alerts.Resolved) 0 -}}
*Resolved:*
{{ range .Alerts.Resolved }}- {{ .Annotations.summary }}: {{
.Annotations.description }}
{{- end }}
{{- end }}
actions:
text: Silence for 1h
type: button
value: google.com
route:
receiver: slack_webhook
group_wait: 10s
group_interval: 5m
repeat_interval: 10m
And the error from that is:
level=info ts=2021-01-20T15:08:34.991Z caller=main.go:231 msg="Starting
Alertmanager" version="(version=0.20.0, branch=HEAD,
revision=f74be0400a6243d10bb53812d6fa408ad71ff32d)"
level=info ts=2021-01-20T15:08:34.991Z caller=main.go:232
build_context="(go=go1.13.5, user=root@00c3106655f8,
date=20191211-14:13:14)"
level=info ts=2021-01-20T15:08:34.995Z caller=cluster.go:623
component=cluster msg="Waiting for gossip to settle..." interval=2s
level=info ts=2021-01-20T15:08:35.091Z caller=coordinator.go:119
component=configuration msg="Loading configuration file"
file=/etc/config/alertmanager.yml
level=error ts=2021-01-20T15:08:35.092Z caller=coordinator.go:124
component=configuration msg="Loading configuration file failed"
file=/etc/config/alertmanager.yml err="yaml: unmarshal errors:\n line 7:
cannot unmarshal !!map into []*config.SlackAction"
level=info ts=2021-01-20T15:08:35.092Z caller=cluster.go:632
component=cluster msg="gossip not settled but continuing anyway" polls=0
elapsed=96.875407ms
Where I should put that test statement to get a button under the Slack
message?
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/fae03d47-9f01-438c-a2de-1a0f24b8c3b0n%40googlegroups.com.