2023-06-14 17:09:06 -05:00
|
|
|
[[- define "__default_message" -]]
|
|
|
|
You have [[ len .Alerts.Firing ]] firing alert(s), and [[ len .Alerts.Resolved ]] resolved alert(s) for [[ .GroupLabels ]]
|
2021-07-19 05:31:51 -05:00
|
|
|
|
2023-06-14 17:09:06 -05:00
|
|
|
[[ if .Alerts.Firing -]]
|
|
|
|
([[ len .Alerts.Firing ]]) FIRING
|
|
|
|
-----------
|
|
|
|
[[ template "__default_alerts_summarize" .Alerts.Firing ]]
|
|
|
|
[[- end ]]
|
2021-07-19 05:31:51 -05:00
|
|
|
|
2023-06-16 03:02:58 -05:00
|
|
|
[[- if .Alerts.Resolved ]]
|
2023-06-14 17:09:06 -05:00
|
|
|
([[ len .Alerts.Resolved ]]) RESOLVED
|
|
|
|
-------------
|
|
|
|
[[ template "__default_alerts_summarize" .Alerts.Resolved ]]
|
|
|
|
[[- end ]]
|
|
|
|
Go to the Alerts page: [[ .AlertPageUrl ]]
|
|
|
|
[[- end -]]
|
2021-07-19 05:31:51 -05:00
|
|
|
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- define "__default_alerts_summarize" -]]
|
|
|
|
[[- range . ]]
|
2023-06-16 09:06:43 -05:00
|
|
|
[[- template "__default_alert_labels" . ]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- template "__default_alert_annotations" . ]]
|
|
|
|
[[ end ]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- end -]]
|
|
|
|
|
|
|
|
[[- define "__default_alert_labels" -]]
|
2023-06-16 09:06:43 -05:00
|
|
|
[[- $labels := .Labels -]]
|
|
|
|
[[- if index $labels "alertname" ]]
|
|
|
|
Alertname: [[ index .Labels "alertname" -]]
|
|
|
|
[[ $labels = $labels.Remove (toStrings (list "alertname")) ]]
|
|
|
|
[[- end ]]
|
|
|
|
Labels: [[ template "__default_sorted_pairs" $labels ]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- end -]]
|
|
|
|
|
|
|
|
[[- define "__default_alert_annotations" -]]
|
|
|
|
[[- $annotations := .Annotations -]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- if index $annotations "summary" ]]
|
|
|
|
Summary: [[ index .Annotations "summary" -]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- $annotations = $annotations.Remove (toStrings (list "summary")) ]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- end -]]
|
|
|
|
[[- if index $annotations "description" ]]
|
|
|
|
Description: [[ index $annotations "description" -]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- $annotations = $annotations.Remove (toStrings (list "description")) ]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- end -]]
|
|
|
|
[[- if index $annotations "runbook_url" ]]
|
|
|
|
Runbook: [[ index $annotations "runbook_url" -]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- $annotations = $annotations.Remove (toStrings (list "runbook_url")) ]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- end -]]
|
|
|
|
[[- if $annotations ]]
|
2023-06-14 17:09:06 -05:00
|
|
|
Annotations: [[ template "__default_sorted_pairs" $annotations ]]
|
2023-06-15 09:04:10 -05:00
|
|
|
[[- end -]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- end -]]
|
|
|
|
|
|
|
|
[[- define "__default_sorted_pairs" -]]
|
|
|
|
[[ range .SortedPairs ]]
|
2023-06-16 03:02:58 -05:00
|
|
|
- [[ .Name ]] = [[ .Value ]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[- end ]]
|
|
|
|
[[- end -]]
|
|
|
|
|
|
|
|
[[- if .Message -]]
|
|
|
|
[[ .Message ]]
|
2023-06-16 03:02:58 -05:00
|
|
|
[[- else -]]
|
2023-06-14 17:09:06 -05:00
|
|
|
[[ template "__default_message" . ]]
|
|
|
|
[[- end ]]
|