alertmanager: AlertManager not sending summary or description
I believe this is just something I haven’t configured properly but all notifications triggered are only sending the following format:
[FIRING|RESOLVED:#] ALERT_NAME (LABELS VALUES...)
Notifications received:
[FIRING:1] KUBERNETES_STATUS (172.17.4.202 kubernetes-cluster 172.17.4.202 node)
[RESOLVED] KUBERNETES_STATUS (172.17.4.202 kubernetes-cluster 172.17.4.202 node)
Labels available:
instance="172.17.4.202" job="kubernetes-cluster" kubernetes_io_hostname="172.17.4.202" kubernetes_role="node"
Example Alerting Rule:
ALERT KUBERNETES_STATUS
IF up{job="kubernetes-cluster"} == 0
FOR 1m
ANNOTATIONS {
summary = "Kubernetes instance: {{$labels.instance}} not responding",
description = "Kubernetes instance: {{$labels.instance}} not responding",
}
Currently using 0.1.0-beta2, and the slack notifier. I am unsure if I need to specify more information in my receiver to structure the alert properly.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 27 (3 by maintainers)
For completeness’ sake, this was my scenario and solution:
@Vannevelj, @asbjornenge, sorry guys, I was thinking you would go for comments, anyway:
I did like this, nothing fancy, for now it works for me:
that picks my summary and description in prometheus’ alert.rules
@cvielma Unfortunately there’s no full documentation on Alertmanager notification templating yet. There’s a blog post to help you get started with the basics: https://prometheus.io/blog/2016/03/03/custom-alertmanager-templates/
For examples of what you can do, have a look at the default templates that you can override in your AM config file: https://github.com/prometheus/alertmanager/blob/master/template/default.tmpl
In case somebody else ends up here; TL;DR; make all your annotations EXACTLY equal. Avoid templating with variability on annotations (like
summary
ordescription
).As pointed out above, source code checks CommonAnnotations. Where it says “Common” it means common to all received alerts. If you are grouping several alerts with different labels within, then it will consider just the common annotations to all of them.
In my case, I had these annotations:
Unfortunately, different grouped alerts had a different
$value
, which means that annotations were not exactly common to all alerts and because of that, they were removed from theCommonAnnotations
array (and therefore, the array was empty).Again, have a look at what this method does: https://github.com/prometheus/alertmanager/blob/v0.26.0/template/template.go#L345 Especially, these: https://github.com/prometheus/alertmanager/blob/v0.26.0/template/template.go#L390-L394
You can skip the template creation in @Vannevelj’s suggestion with something like:
Which will get you something like:
More useful info found in my Googlings:
If you are using confd, then you need to escape the curly braces: Ex:
name: 'slack_chatbots'slack_configs: - send_resolved: true api_url: '<url of slack web hook>' channel: '#test' text: 'https://internal.myorg.net/wiki/alerts/{{"{{"}} .GroupLabels.alertname {{"}}"}}'