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

@ -28,18 +28,19 @@ local function check_interface_idle(params)
end
end
local idle_type = alert_consts.alert_types.alert_slow_purge.create(
alert_severities.warning,
alert_consts.alerts_granularities.min,
max_idle,
max_idle_perc,
threshold
)
local alert = alert_consts.alert_types.alert_slow_purge.new(
max_idle,
max_idle_perc,
threshold
)
alert:set_severity(alert_severities.warning)
alert:set_granularity(params.granularity)
if max_idle_perc > threshold then
alerts_api.trigger(params.alert_entity, idle_type, nil, params.cur_alerts)
alert:trigger(params.alert_entity, nil, params.cur_alerts)
else
alerts_api.release(params.alert_entity, idle_type, nil, params.cur_alerts)
alert:release(params.alert_entity, nil, params.cur_alerts)
end
end