mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 17:30:11 +00:00
Migrates alerts to an object-oriented implementation
This commit is contained in:
parent
c1a7ff08ae
commit
fbc283f12f
108 changed files with 2793 additions and 1737 deletions
|
|
@ -5,6 +5,7 @@
|
|||
local alerts_api = require "alerts_api"
|
||||
local flow_consts = require("flow_consts")
|
||||
local alert_severities = require "alert_severities"
|
||||
local alert_consts = require("alert_consts")
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -23,12 +24,13 @@ local handler = {}
|
|||
function handler.handle_risk(risk_id, flow_score, cli_score, srv_score)
|
||||
-- Set a flow status for the generic flow_risk. This will also
|
||||
-- cause an alert to be generated.
|
||||
local flow_risk_type = flow_consts.status_types.status_flow_risk.create(
|
||||
local alert = alert_consts.alert_types.alert_flow_risk.new(
|
||||
risk_id
|
||||
)
|
||||
|
||||
alerts_api.trigger_status(flow_risk_type, alert_severities.warning, cli_score or 0, srv_score or 0, flow_score or 0)
|
||||
|
||||
alert:set_severity(alert_severities.warning)
|
||||
|
||||
alert:trigger_status(cli_score or 0, srv_score or 0, flow_score or 0)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue