Merge pull request #326 from teemow/master

Add resolved alerts to pushover template
This commit is contained in:
Fabian Reinartz 2016-04-27 12:03:33 +01:00
commit 4ed3b79640
3 changed files with 13 additions and 4 deletions

View File

@ -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)"

View File

@ -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