alertmanager: if there are no alerts to send, do nothing

This commit is contained in:
Corentin Chary 2018-03-15 10:07:22 +01:00
parent eef01e3703
commit 777c1024c9

View File

@ -78,6 +78,10 @@ func (this *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) erro
alerts = append(alerts, alertJSON)
}
if len(alerts) == 0 {
return nil
}
bodyJSON := simplejson.NewFromAny(alerts)
body, _ := bodyJSON.MarshalJSON()