mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add default message for Pushover notifications
If the message field is left empty for Pushover notifications, the API will return an error. This adds a default message if the message would otherwise be empty. This fixes #8006.
This commit is contained in:
committed by
Alfred Krohmer
parent
5d70a36ad8
commit
72e686457c
@@ -129,6 +129,7 @@ func (this *PushoverNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
this.log.Error("Failed get rule link", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
message := evalContext.Rule.Message
|
||||
for idx, evt := range evalContext.EvalMatches {
|
||||
message += fmt.Sprintf("\n<b>%s</b>: %v", evt.Metric, evt.Value)
|
||||
@@ -142,6 +143,9 @@ func (this *PushoverNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
if evalContext.ImagePublicUrl != "" {
|
||||
message += fmt.Sprintf("\n<a href=\"%s\">Show graph image</a>", evalContext.ImagePublicUrl)
|
||||
}
|
||||
if message == "" {
|
||||
message = "Nothing to see here! (Set a notification message to replace this text.)"
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Add("user", this.UserKey)
|
||||
|
||||
Reference in New Issue
Block a user