MCPcopy Create free account
hub / github.com/TalkingData/owl / doAlarmAction

Function doAlarmAction

controller/notify.go:94–108  ·  view source on GitHub ↗

发送报警

(strategy_event *types.StrategyEvent, trigger_events map[string]*types.TriggerEvent)

Source from the content-addressed store, hash-verified

92
93//发送报警
94func doAlarmAction(strategy_event *types.StrategyEvent, trigger_events map[string]*types.TriggerEvent) {
95 strategy_event.Status = types.EVENT_NEW
96 actions := mydb.GetAllActions(strategy_event.StrategyID)
97 for _, action := range actionFilter(actions, strategy_event) {
98 lg.Info("do action:%v", action)
99 switch action.Kind {
100 case types.ACTION_NOTIFY:
101 subject := action.AlarmSubject
102 content := fillTemplate(action.AlarmTemplate, generateTemplateObj(strategy_event, triggerEventFilter(trigger_events, types.ACTION_ALARM)))
103 go broadcast(strategy_event, subject, content, action)
104 case types.ACTION_RUN:
105 go doRun(strategy_event, action)
106 }
107 }
108}
109
110//发送恢复通知
111func doRestoreAction(strategy_event *types.StrategyEvent, trigger_events map[string]*types.TriggerEvent) {

Callers 1

processSingleEventFunction · 0.85

Calls 7

actionFilterFunction · 0.85
fillTemplateFunction · 0.85
generateTemplateObjFunction · 0.85
triggerEventFilterFunction · 0.85
broadcastFunction · 0.85
doRunFunction · 0.85
GetAllActionsMethod · 0.80

Tested by

no test coverage detected