mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
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:
parent
17a22ef986
commit
acdab024da
8 changed files with 134 additions and 158 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue