Enqueueing flow alerts to be stored/notified from Lua, removed DB select to notiy alert (using the alert object directly)

This commit is contained in:
Alfredo Cardigliano 2019-11-05 15:53:10 +01:00
parent 17a22ef986
commit acdab024da
8 changed files with 134 additions and 158 deletions

View file

@ -6,6 +6,8 @@ local alert_endpoints = {}
package.path = dirs.installdir .. "/scripts/lua/modules/alert_endpoints/?.lua;" .. package.path
local alert_consts = require("alert_consts")
--
-- Generic alerts extenral report
--
@ -16,8 +18,6 @@ package.path = dirs.installdir .. "/scripts/lua/modules/alert_endpoints/?.lua;"
-- - A [module] name must have a corresponding modules/[module]_utils.lua script
--
local MAX_NUM_PER_MODULE_QUEUED_ALERTS = 1024 -- should match ALERTS_MANAGER_MAX_ENTITY_ALERTS on the AlertsManager
-- ##############################################
-- NOTE: order is important as it defines evaluation order
@ -128,7 +128,7 @@ function alert_endpoints.dispatchNotification(message, json_message)
for _, m in ipairs(modules) do
if tonumber(message.alert_severity) >= alertSeverity(m.severity) then
ntop.rpushCache(m.export_queue, json_message, MAX_NUM_PER_MODULE_QUEUED_ALERTS)
ntop.rpushCache(m.export_queue, json_message, alert_consts.MAX_NUM_QUEUED_ALERTS_PER_MODULE)
end
end
end