From 777c1024c9d99658e9a025087074242efba87822 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Thu, 15 Mar 2018 10:07:22 +0100 Subject: [PATCH] alertmanager: if there are no alerts to send, do nothing --- pkg/services/alerting/notifiers/alertmanager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/services/alerting/notifiers/alertmanager.go b/pkg/services/alerting/notifiers/alertmanager.go index 08f8e8be29c..607a97d977c 100644 --- a/pkg/services/alerting/notifiers/alertmanager.go +++ b/pkg/services/alerting/notifiers/alertmanager.go @@ -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()