From fb8cf155376f0f0556d15a51cea2822688a973f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= Date: Tue, 22 Sep 2026 15:06:48 +0800 Subject: [PATCH] fix: Fix the automatic renewal certificate alert issue (#13895) --- agent/app/service/alert_helper.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/agent/app/service/alert_helper.go b/agent/app/service/alert_helper.go index 4a7ed87d9..d51c65317 100644 --- a/agent/app/service/alert_helper.go +++ b/agent/app/service/alert_helper.go @@ -30,10 +30,11 @@ import ( ) const ( - ResourceAlertInterval = 30 - CheckIntervalSec = 3 - LoadCheckIntervalMin = 5 - sshIPLoginWindow = 30 * time.Minute + ResourceAlertInterval = 30 + CheckIntervalSec = 3 + LoadCheckIntervalMin = 5 + sshIPLoginWindow = 30 * time.Minute + sslAutoRenewAlertSkipDays = 31 ) type AlertTaskHelper struct { @@ -864,7 +865,7 @@ func calculateSSLExpiryDays(sslList []model.WebsiteSSL, cycle uint) (map[int][]s daysDiff := int(math.Ceil( ssl.ExpireDate.Sub(currentDate).Hours() / 24, )) - if daysDiff > 0 && int(cycle) >= daysDiff { + if daysDiff > 0 && int(cycle) >= daysDiff && !shouldSuppressSSLExpiryAlert(ssl, daysDiff) { daysDiffMap[daysDiff] = append(daysDiffMap[daysDiff], ssl.PrimaryDomain) projectMap[ssl.ID] = append(projectMap[ssl.ID], ssl.ExpireDate) } @@ -872,6 +873,10 @@ func calculateSSLExpiryDays(sslList []model.WebsiteSSL, cycle uint) (map[int][]s return daysDiffMap, projectMap } +func shouldSuppressSSLExpiryAlert(ssl model.WebsiteSSL, remainingDays int) bool { + return ssl.AutoRenew && remainingDays < sslAutoRenewAlertSkipDays +} + func calculateWebsiteExpiryDays(websites []model.Website, cycle uint) (map[int][]string, map[uint][]time.Time) { currentDate := time.Now() daysDiffMap := make(map[int][]string)