向离线探针发送监控配置不再输出错误日志

This commit is contained in:
dushixiang committed 2025-12-30 22:44:58 +08:00
1 parent f9e559be30
commit 35ad182a60
1 file changed
+10 -5
+10 -5
View File
@@ -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))
}
}
}