LINE Notify to have Alerts and OK notifications (#27639)

* Get Alerts AND OKs for LINE Notify

* Get Alerts AND OKs for LINE Notify

* Get Alerts AND OKs for LINE Notify
This commit is contained in:
Harald Kubota 2020-09-24 22:45:53 +09:00 committed by GitHub
parent 755f3d0de7
commit 81bf9fc278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,11 +59,8 @@ type LineNotifier struct {
// Notify send an alert notification to LINE
func (ln *LineNotifier) Notify(evalContext *alerting.EvalContext) error {
ln.log.Info("Executing line notification", "ruleId", evalContext.Rule.ID, "notification", ln.Name)
if evalContext.Rule.State == models.AlertStateAlerting {
return ln.createAlert(evalContext)
}
return nil
return ln.createAlert(evalContext)
}
func (ln *LineNotifier) createAlert(evalContext *alerting.EvalContext) error {
@ -75,7 +72,7 @@ func (ln *LineNotifier) createAlert(evalContext *alerting.EvalContext) error {
}
form := url.Values{}
body := fmt.Sprintf("%s - %s\n%s", evalContext.Rule.Name, ruleURL, evalContext.Rule.Message)
body := fmt.Sprintf("%s - %s\n%s", evalContext.GetNotificationTitle(), ruleURL, evalContext.Rule.Message)
form.Add("message", body)
if ln.NeedsImage() && evalContext.ImagePublicURL != "" {