Migrates alerts to an object-oriented implementation

This commit is contained in:
matteo 2020-12-22 12:58:51 +01:00
parent c1a7ff08ae
commit fbc283f12f
108 changed files with 2793 additions and 1737 deletions

View file

@ -31,17 +31,18 @@ local function dropped_alerts_check(params)
-- Compute the delta with the previous value for drops
local delta_drops = alerts_api.interface_delta_val(script.key, params.granularity, dropped_alerts, true --[[ skip first --]])
local alert_type = alert_consts.alert_types.alert_dropped_alerts.create(
alert_severities.error,
alert_consts.alerts_granularities[params.granularity],
local alert = alert_consts.alert_types.alert_dropped_alerts.new(
interface.getId(),
delta_drops
)
)
alert:set_severity(alert_severities.error)
alert:set_granularity(params.granularity)
if(delta_drops > 0) then
alerts_api.trigger(params.alert_entity, alert_type, nil, params.cur_alerts)
alert:trigger(params.alert_entity, nil, params.cur_alerts)
else
alerts_api.release(params.alert_entity, alert_type, nil, params.cur_alerts)
alert:release(params.alert_entity, nil, params.cur_alerts)
end
end