douhang8991
douhang8991
2019-05-08 12:25

Prometheus警报管理器模板更改

  • prometheus

I have prometheus alert manager running with a template, and im getting email subject as following

[FIRING:6] Unusual network throughput out (thanos group_b aws_us_b instance_191 infrastructure monitoring-prometheus-node warning)

all the values after the alert name are labels. here is the template subject code

{{ define "__subject" }}[{{ .Status | toUpper }} {{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]  {{ .GroupLabels.SortedPairs.Values | join " " }}  {{ if gt (len .CommonLabels) (len .GroupLabels) }} ({{ with .CommonLabels.Remove .GroupLabels.Names }}   {{ .Values | join " " }}   {{ end }}) {{ end }}{{ end }}

I would like to modify this only to get following

[FIRING:6] Unusual network throughput out (group_b instance_191) only group name and instance name

how can I achieve this?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐