douhang8991
2019-05-08 12:25
浏览 289
已采纳

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?

图片转代码服务由CSDN问答提供 功能建议

我的普罗米修斯警报管理器运行有模板,并且正在获取电子邮件主题,如下所示</ p> \ n

[FIRING:6]异常的网络吞吐量输出(thanos group_b aws_us_b instance_191基础结构监视-prometheus-node警告)</ p> </ blockquote>

警报名称后面的所有值都是标签。 这是模板主题代码</ p>

  {{define“ __subject”}} [{{.Status |  toUpper}} {{如果eq .Status“ firing”}}:{{.Alerts.Firing |  len}} {{end}}] {{.GroupLabels.SortedPairs.Values | 加入“”}} {{如果是gt(len .CommonLabels)(len .GroupLabels)}}({{与.CommonLabels.Remove .GroupLabels.Names}} {{.Values | join“”}} {{end}}  ){{end}} {{end}} 
 </ code> </ pre> 
 
 

我只想修改此内容以得到关注</ p>

[ 射击:6]异常的网络吞吐量输出(group_b instance_191)\仅组名和实例名</ p>

我该如何实现?</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题