timonwong / prometheus-webhook-dingtalk

DingTalk integration for Prometheus Alertmanager
http://theo.im/blog/2017/10/16/release-prometheus-alertmanager-webhook-for-dingtalk/
Apache License 2.0
911 stars 311 forks source link

怎么获取 故障持续时间 #194

Closed lss144 closed 1 year ago

lss144 commented 2 years ago

如题 请问怎么在template里获取故障持续时间 @timonwong

Spinestars commented 2 years ago
{{ define "my.__text_firing_list" }}{{ range . }}
**报警时间:** {{ dateInZone "2006.01.02 15:04:05" (.StartsAt) "Asia/Shanghai" }}
{{ template "my.__text_alert_list" . }}
{{ end }}{{ end }}

{{ define "my.__text_resolved_list" }}{{ range . }}
**持续时间:** {{ dateInZone "2006.01.02 15:04:05" (.StartsAt) "Asia/Shanghai" }} to {{ dateInZone "2006.01.02 15:04:05" (.EndsAt) "Asia/Shanghai" }}
{{ template "my.__text_alert_list" . }}
{{ end }}{{ end }}