Prometheus - 夜莺feishucard模版
2024-09-10
{{ if ne .Cate "host" }}{{ if .IsRecovered }}
{{- if and $labels.provider $labels.code }}
**产品名称:** [{{ $labels.provider }} {{ $labels.code }}]({{.AnnotationsJSON.provider_url }})
{{- else if $labels.provider }}
**产品名称:** [{{ $labels.provider }}]({{.AnnotationsJSON.provider_url }})
{{- else if $labels.code }}
**产品名称:** [{{ $labels.code }}]({{.AnnotationsJSON.provider_url }})
{{- end }}
{{- if $labels.region }}**告警地域:** {{ $labels.region }}{{- end}}
**恢复状态:** Recovered
{{- if .AnnotationsJSON.monitor_object }}**恢复对象:** {{ .AnnotationsJSON.monitor_object }}{{- end}}
{{$time_duration := sub now.Unix .FirstTriggerTime }} {{$time_duration = sub .LastEvalTime .FirstTriggerTime }} {{$totalDuration := add $time_duration .PromForDuration}}
**持续时长**: {{humanizeDurationInterface $totalDuration}}
{{if .AnnotationsJSON.recovery_value}}**恢复信息**: **{{.AnnotationsJSON.recovery_value}}**{{.AnnotationsJSON.unit}}
{{end}}
{{- else }}
{{- if and $labels.provider $labels.code }}
**产品名称:** [{{ $labels.provider }} {{ $labels.code }}]({{.AnnotationsJSON.provider_url }})
{{- else if $labels.provider }}
**产品名称:** [{{ $labels.provider }}]({{.AnnotationsJSON.provider_url }})
{{- else if $labels.code }}
**产品名称:** [{{ $labels.code }}]({{.AnnotationsJSON.provider_url }})
{{- end }}
{{- if $labels.region }}**告警地域:** {{ $labels.region }}{{- end}}
**告警状态:** Triggered
{{- if .AnnotationsJSON.monitor_object }}**告警对象:** {{ .AnnotationsJSON.monitor_object }}{{- end}}
**告警信息:** {{ .AnnotationsJSON.description }}
**告警触发:** {{timeformat .FirstTriggerTime}}(CST)
{{end}}{{end}}
{{if .AnnotationsJSON.dashboard_url }}[查看监控面板]({{.AnnotationsJSON.dashboard_url}}){{end}}
{{$domain := "https://n9e.paigod.work" }}[修改告警规则]({{$domain}}/alert-rules/edit/{{.RuleId}})
[查看告警详情 & 屏蔽此条告警]({{$domain}}/alert-his-events/{{.Id}})
标题:Prometheus - 夜莺feishucard模版
地址:https://blog.njqhome.com:8443/articles/2024/09/10/1725950254823.html