From 1b986078f03ec9bb409027fe983df4f0f287f8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Sun, 12 Feb 2023 14:32:05 +0100 Subject: [PATCH] silence: Don't add silence action to resolved alerts --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 83b9660..97c297b 100644 --- a/main.go +++ b/main.go @@ -110,7 +110,7 @@ func (rcv *receiver) singleAlertNotifications(p *payload) []*notification { n.tags = strings.Join(tags, ",") - if rcv.cfg.am.SilenceDuration != 0 { + if rcv.cfg.am.SilenceDuration != 0 && alert.Status == "firing" { if rcv.cfg.BaseURL == "" { rcv.logger.Error("Failed to create silence action: No base-url set") } @@ -199,7 +199,7 @@ func (rcv *receiver) multiAlertNotification(p *payload) *notification { n.priority = priority n.tags = tagString - if rcv.cfg.am.SilenceDuration != 0 { + if rcv.cfg.am.SilenceDuration != 0 && p.Status == "firing" { if rcv.cfg.BaseURL == "" { rcv.logger.Error("Failed to create silence action: No base-url set") }