From 35ad182a6056522f17ac9f69bf33fe05a67fc6cf Mon Sep 17 00:00:00 2001 From: dushixiang Date: Tue, 30 Dec 2025 22:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=91=E7=A6=BB=E7=BA=BF=E6=8E=A2=E9=92=88?= =?UTF-8?q?=E5=8F=91=E9=80=81=E7=9B=91=E6=8E=A7=E9=85=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E8=BE=93=E5=87=BA=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/monitor_service.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/service/monitor_service.go b/internal/service/monitor_service.go index 9f45a83..f1a1c2d 100644 --- a/internal/service/monitor_service.go +++ b/internal/service/monitor_service.go @@ -3,6 +3,7 @@ package service import ( "context" "encoding/json" + "errors" "fmt" "strings" @@ -318,11 +319,15 @@ func (s *MonitorService) SendMonitorTaskToAgents(ctx context.Context, monitor mo // 向每个目标探针发送 for _, agentID := range targetAgentIDs { if err := s.sendMonitorConfigToAgent(agentID, payload); err != nil { - s.logger.Error("发送监控配置失败", - zap.String("taskID", monitor.ID), - zap.String("taskName", monitor.Name), - zap.String("agentID", agentID), - zap.Error(err)) + if errors.Is(err, ws.ErrClientNotFound) { + // 忽略未连接的探针 + } else { + s.logger.Error("发送监控配置失败", + zap.String("taskID", monitor.ID), + zap.String("taskName", monitor.Name), + zap.String("agentID", agentID), + zap.Error(err)) + } } }