silence: Don't add silence action to resolved alerts

This commit is contained in:
Thorben Günther 2023-02-12 14:32:05 +01:00
parent 0a3ead8b6e
commit 1b986078f0
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED

View file

@ -110,7 +110,7 @@ func (rcv *receiver) singleAlertNotifications(p *payload) []*notification {
n.tags = strings.Join(tags, ",") n.tags = strings.Join(tags, ",")
if rcv.cfg.am.SilenceDuration != 0 { if rcv.cfg.am.SilenceDuration != 0 && alert.Status == "firing" {
if rcv.cfg.BaseURL == "" { if rcv.cfg.BaseURL == "" {
rcv.logger.Error("Failed to create silence action: No base-url set") 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.priority = priority
n.tags = tagString n.tags = tagString
if rcv.cfg.am.SilenceDuration != 0 { if rcv.cfg.am.SilenceDuration != 0 && p.Status == "firing" {
if rcv.cfg.BaseURL == "" { if rcv.cfg.BaseURL == "" {
rcv.logger.Error("Failed to create silence action: No base-url set") rcv.logger.Error("Failed to create silence action: No base-url set")
} }