|
|
@ -37,10 +37,10 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination |
|
|
|
esAggPointsCount := len(esAggData.Aggregations.GroupBySensor.Buckets) |
|
|
|
|
|
|
|
detailMsg := "" |
|
|
|
itemAlarmCounts := 0 // >=2有效
|
|
|
|
for _, esBucket := range esAggData.Aggregations.GroupBySensor.Buckets { |
|
|
|
stationId, _ := strconv.Atoi(esBucket.Key) |
|
|
|
for _, item := range config.ConfigItems { |
|
|
|
factorItemAlarmCounts := 0 // >=2有效
|
|
|
|
for _, item := range config.ConfigItems { |
|
|
|
for _, esBucket := range esAggData.Aggregations.GroupBySensor.Buckets { |
|
|
|
stationId, _ := strconv.Atoi(esBucket.Key) |
|
|
|
found := slices.Contains(item.StationIds, stationId) |
|
|
|
if found { |
|
|
|
|
|
|
@ -48,10 +48,11 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination |
|
|
|
detailMsg += "," |
|
|
|
} |
|
|
|
if stationName, ok := the.Info[stationId]; ok { |
|
|
|
if itemAlarmCounts < 2 { |
|
|
|
if factorItemAlarmCounts < 2 { |
|
|
|
detailMsg += stationName |
|
|
|
} |
|
|
|
itemAlarmCounts += 1 |
|
|
|
factorItemAlarmCounts += 1 |
|
|
|
break //一种类型有一个点就跳出
|
|
|
|
} else { |
|
|
|
log.Printf("测点[%d]无匹配的名称", stationId) |
|
|
|
} |
|
|
@ -60,11 +61,11 @@ func (the Adaptor_ZWY_AlarmCombin) Transform(config AlarmCombination.Combination |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if itemAlarmCounts < 2 { |
|
|
|
if factorItemAlarmCounts < 2 { |
|
|
|
log.Printf("es 聚集查询告警组数=%d < 2", esAggPointsCount) |
|
|
|
return nil |
|
|
|
} |
|
|
|
msg := fmt.Sprintf("组合告警[%s]产生,有效触发测点:%s 等,共%d个", config.Name, detailMsg, itemAlarmCounts) |
|
|
|
msg := fmt.Sprintf("组合告警[%s]产生,有效触发测点:%s 等,共%d个", config.Name, detailMsg, factorItemAlarmCounts) |
|
|
|
|
|
|
|
log.Printf(msg) |
|
|
|
prefix := "zh-" |
|
|
|