feat: nbi
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"be.ems/features/nbi/redisqueue"
|
||||
"be.ems/lib/config"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/global"
|
||||
@@ -476,6 +477,24 @@ func PostAlarmFromNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Error("Failed to AlarmSMSForward:", err)
|
||||
}
|
||||
}
|
||||
if config.GetYamlConfig().Alarm.RelatedRules.Enabled {
|
||||
relatedId, found := JudgeRelated(&alarmData, session, config.RelationRules.Related)
|
||||
if found {
|
||||
id, err := InsertAlarmRelation(session, alarmData.AlarmId, relatedId, "related")
|
||||
if err != nil {
|
||||
log.Error("Failed to insert alarm relation:", err)
|
||||
}
|
||||
redisqueue.AddAlarmRelationQueue([]string{strconv.FormatInt(id, 10)})
|
||||
}
|
||||
derivedId, found := JudgeDerived(&alarmData, session)
|
||||
if found {
|
||||
id, err := InsertAlarmRelation(session, alarmData.AlarmId, derivedId, "derived")
|
||||
if err != nil {
|
||||
log.Error("Failed to insert alarm relation:", err)
|
||||
}
|
||||
redisqueue.AddAlarmRelationQueue([]string{strconv.FormatInt(id, 10)})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
services.ResponseStatusOK200Null(w)
|
||||
|
||||
Reference in New Issue
Block a user