Skip to content

Commit

Permalink
fix:修复端口探测策略告警缺陷
Browse files Browse the repository at this point in the history
  • Loading branch information
jinronga committed Dec 27, 2024
1 parent 1b3d1d6 commit fa3a1d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/server/houyi/internal/data/repoimpl/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (s *strategyRepositoryImpl) resolvedAlerts(ctx context.Context, strategy bo
// Eval 评估策略 告警/恢复
func (s *strategyRepositoryImpl) Eval(ctx context.Context, strategy bo.IStrategy) (*bo.Alarm, error) {
alarmInfo := strategy.BuilderAlarmBaseInfo()
// 恢复告警
if !strategy.GetStatus().IsEnable() {
alerts := s.resolvedAlerts(ctx, strategy)
alarmInfo.Alerts = alerts
Expand Down
6 changes: 3 additions & 3 deletions pkg/houyi/datasource/endpoint_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func EndpointPortEval(_ context.Context, endpoint string, port uint32, timeout t
Labels: labels.Map(),
Values: []*Value{
{
Value: 0,
Value: 1,
Timestamp: now.Unix(),
},
},
}
return points, err
return points, nil
}
// 连接成功,关闭连接
defer conn.Close()
Expand All @@ -37,7 +37,7 @@ func EndpointPortEval(_ context.Context, endpoint string, port uint32, timeout t
Labels: labels.Map(),
Values: []*Value{
{
Value: 1,
Value: 0,
Timestamp: now.Unix(),
},
},
Expand Down

0 comments on commit fa3a1d5

Please sign in to comment.