Excluding labels from alertmanager email alerts

1,336 views
Skip to first unread message

rajasekhar kommineni

unread,
Mar 3, 2021, 2:31:37 PM3/3/21
to Prometheus Users
Hi All,

I want to exclude Labels for each item in the alerts. Is there are way to that

Also I would like to know if we can modify the email template to send the below alerts in tabular format.

[3] Firing
Labels
alertname = Low data disk space
device = /dev/sda4
fstype = xfs
instance = node1
job = Node_Exporter
mountpoint = /data1
severity = warning
Annotations
description = Free Space Percentage for /data1 is 91.00
summary = Low Disk Space on node1
Source

Labels
alertname = Low data disk space
device = /dev/sda4
fstype = xfs
instance = node2
job = Node_Exporter
mountpoint = /data1
severity = warning
Annotations
description = Free Space Percentage for /data1 is 87.00
summary = Low Disk Space on node2
Source

Labels
alertname = Low data disk space
Application = RxReturns
Product = Incorta
device = xfs
fstype = nfs
instance = node3
job = Node_Exporter
mountpoint = /var
severity = warning
Annotations
description = Free Space Percentage for /var is 92.00
summary = Low Disk Space on node3
Source

Thanks,


Matthias Rampke

unread,
Mar 6, 2021, 4:04:41 AM3/6/21
to rajasekhar kommineni, Prometheus Users
The best way to exclude certain labels for certain alerts is to aggregate them away in the alert expression. Which aggregation (sum, avg, max, min etc) makes sense depends on the semantics if the metric.

Yes, you can change the alert email template, there are examples how to do that here: https://prometheus.io/docs/alerting/latest/notification_examples/

For reference, the default template is here, you can work off that or start from scratch: https://github.com/prometheus/alertmanager/blob/master/template/email.html

/MR

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e2ebb81e-9da6-4f31-8123-2c428fa2c65an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages