mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-06 05:31:44 +00:00
Add resolved alerts to pushover template
The pushover notification of resolved alerts can end up in an empty message (only a newline). I've fixed the check for an empty message with trimming the whitespace. But I also thought that adding the resolved alerts to the message would be helpful.
This commit is contained in:
parent
318db91b8b
commit
68232da066
@ -759,6 +759,7 @@ func (n *Pushover) Notify(ctx context.Context, as ...*types.Alert) error {
|
||||
message = message[:512-len(title)]
|
||||
log.With("incident", key).Debugf("Truncated message to %q due to Pushover message limit", message)
|
||||
}
|
||||
message = strings.TrimSpace(message)
|
||||
if message == "" {
|
||||
// Pushover rejects empty messages.
|
||||
message = "(no details)"
|
||||
|
@ -165,5 +165,13 @@ SOFTWARE.
|
||||
|
||||
{{ define "pushover.default.title" }}{{ template "__subject" . }}{{ end }}
|
||||
{{ define "pushover.default.message" }}{{ .CommonAnnotations.SortedPairs.Values | join " " }}
|
||||
{{ template "__text_alert_list" .Alerts.Firing }}{{ end }}
|
||||
{{ if gt (len .Alerts.Firing) 0 }}
|
||||
Alerts Firing:
|
||||
{{ template "__text_alert_list" .Alerts.Firing }}
|
||||
{{ end }}
|
||||
{{ if gt (len .Alerts.Resolved) 0 }}
|
||||
Alerts Resolved:
|
||||
{{ template "__text_alert_list" .Alerts.Resolved }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ define "pushover.default.url" }}{{ template "__alertmanagerURL" . }}{{ end }}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user