diff --git a/pkg/services/alerting/notifiers/slack.go b/pkg/services/alerting/notifiers/slack.go index e7b6ab79456..f266c8cd095 100644 --- a/pkg/services/alerting/notifiers/slack.go +++ b/pkg/services/alerting/notifiers/slack.go @@ -23,11 +23,13 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) { } recipient := model.Settings.Get("recipient").MustString() + mention := model.Settings.Get("mention").MustString() return &SlackNotifier{ NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings), Url: url, Recipient: recipient, + Mention: mention, log: log.New("alerting.notifier.slack"), }, nil } @@ -36,6 +38,7 @@ type SlackNotifier struct { NotifierBase Url string Recipient string + Mention string log log.Logger } @@ -70,9 +73,9 @@ func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error { }) } - message := "" + message := this.Mention if evalContext.Rule.State != m.AlertStateOK { //dont add message when going back to alert state ok. - message = evalContext.Rule.Message + message += " " + evalContext.Rule.Message } body := map[string]interface{}{ diff --git a/public/app/features/alerting/partials/notification_edit.html b/public/app/features/alerting/partials/notification_edit.html index 47999b5289d..efb22e2e05a 100644 --- a/public/app/features/alerting/partials/notification_edit.html +++ b/public/app/features/alerting/partials/notification_edit.html @@ -74,6 +74,17 @@ Override default channel or user, use #channel-name or @username +
+ Mention + + + + Mention a user or a group using @ when notifying in a channel + +