通知内 IP 脱敏

This commit is contained in:
naiba
2021-05-27 20:48:12 +08:00
parent 06914eed99
commit 2b05dcfc23
9 changed files with 76 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/naiba/nezha/model"
"github.com/naiba/nezha/pkg/utils"
)
// 报警规则
@@ -100,7 +101,7 @@ func checkStatus() {
// 发送通知
max, desc := alert.Check(alertsStore[alert.ID][server.ID])
if desc != "" {
message := fmt.Sprintf("报警规则:%s服务器%s(%s)%s逮到咯,快去看看!", alert.Name, server.Name, server.Host.IP, desc)
message := fmt.Sprintf("报警规则:%s服务器%s(%s),逮到咯,快去看看!", alert.Name, server.Name, utils.IPDesensitize(server.Host.IP))
go SendNotification(message, true)
}
// 清理旧数据