mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fixes alert utils nil value
This commit is contained in:
parent
2df2ae82df
commit
4a5f8f8a08
1 changed files with 7 additions and 1 deletions
|
|
@ -813,7 +813,13 @@ function alert_utils.housekeepingAlertsMakeRoom(ifId)
|
|||
if ntop.getCache(k["flows"]) == "1" then
|
||||
ntop.delCache(k["flows"])
|
||||
local res = interface.queryFlowAlertsRaw("SELECT count(*) count") or {}
|
||||
local count = tonumber(res[1].count)
|
||||
local count = nil
|
||||
|
||||
-- res can be an empty table, so a check is needed
|
||||
if table.len(res) >= 2 then
|
||||
count = tonumber(res[1].count)
|
||||
end
|
||||
|
||||
if count ~= nil and count >= max_num_flow_alerts then
|
||||
local to_keep = (max_num_flow_alerts * 0.8)
|
||||
to_keep = round(to_keep, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue