Last active
September 12, 2025 03:47
-
-
Save UlricQin/4888000d2734dd2a8f1409c1f63c5caa to your computer and use it in GitHub Desktop.
夜莺监控发送企微告警消息的模板
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{$time_duration := sub now.Unix $event.FirstTriggerTime }}{{if $event.IsRecovered}}{{$time_duration = sub $event.LastEvalTime $event.FirstTriggerTime }}{{end}} | |
| {{if $event.IsRecovered}}🟢{{else}}🔴{{end}} {{$event.RuleName}} | |
| --- | |
| **💨告警级别**: {{$event.Severity}}级 | |
| {{- if $event.RuleNote}} | |
| **📜规则备注**: {{$event.RuleNote}} | |
| {{- end -}} | |
| {{if not $event.IsRecovered}} | |
| **⏱️发送时间**: {{timeformat $event.TriggerTime}} | |
| **🧭持续时长**: {{humanizeDurationInterface $time_duration}} | |
| **📈告警时值**: {{$event.TriggerValue}} | |
| {{else}} | |
| {{- if $event.AnnotationsJSON.recovery_value}} | |
| **📈恢复时值**: {{formatDecimal $event.AnnotationsJSON.recovery_value 4}} | |
| {{- end}} | |
| **⏱️恢复时间**: {{timeformat $event.LastEvalTime}} | |
| **🧭告警持续时长**: {{humanizeDurationInterface $time_duration}} | |
| {{end}} | |
| {{- if $event.AnnotationsJSON}} | |
| **📚附加信息**: | |
| {{- range $key, $val := $event.AnnotationsJSON}} | |
| > - {{$key}}: {{$val}} | |
| {{- end}} | |
| {{end}} | |
| {{- if $event.TagsMap}} | |
| **🏷️事件标签**: | |
| ``` | |
| {{- range $key, $val := $event.TagsMap}} | |
| {{ if ne $key "rulename" }}{{$key}}: {{$val}}{{ end }} | |
| {{- end -}} | |
| ``` | |
| {{- end}} | |
| {{$domain := "http://localhost:17000" }} | |
| [事件详情]({{$domain}}/share/alert-his-events/{{$event.Id}}) | [屏蔽1小时]({{$domain}}/alert-mutes/add?__event_id={{$event.Id}}){{if eq $event.Cate "prometheus"}} | [查看曲线]({{$domain}}/metric/explorer?__event_id={{$event.Id}}&mode=graph){{end}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


告警消息:

恢复消息:
