Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

告警恢复,飞书发送模板还是红色的 #354

Closed
aichengli opened this issue Oct 26, 2023 · 3 comments
Closed

告警恢复,飞书发送模板还是红色的 #354

aichengli opened this issue Oct 26, 2023 · 3 comments

Comments

@aichengli
Copy link

{{ $var := .externalURL}}{{ range $k,$v:=.alerts }}{{if eq $v.status "resolved"}}Prometheus恢复信息
{{$v.labels.alertname}}
告警级别:{{$v.labels.severity}}
开始时间:{{$v.startsAt}}
结束时间:{{$v.endsAt}}
故障主机IP:{{$v.labels.instance}}
{{$v.annotations.description}}{{else}}Prometheus告警信息
{{$v.labels.alertname}}
告警级别:{{$v.labels.severity}}
开始时间:{{$v.startsAt}}
故障主机IP:{{$v.labels.instance}}
{{$v.annotations.description}}{{end}}{{ end }}
{{ $urimsg:=""}}{{ range $key,$value:=.commonLabels }}{{$urimsg = print $urimsg $key "%3D%22" $value "%22%2C" }}{{end}}[*** 点我屏蔽该告警]({{$var}}/#/silences/new?filter=%7B{{SplitString $urimsg 0 -3}}%7D)

默认模板 {{if eq $v.status "resolved"}} 当我传入状态为resloved的内容是,飞书通知还是红色的。 看了源码没啥问题

@zhangnan30
Copy link

需要在模板里加个告警状态就好了,如下:
image
image

@niutendo
Copy link

太溜了

@aichengli
Copy link
Author

解决了,感觉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants