mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Fixes alert scan that was causing possible issues in periodic scripts
Method scanAlerts was called inside a loop over the interfaces in minute.lua. Since scanAlerts was looping over the interfaces as well, this was causing interfaces to be deselected from the outer loop. This commit fixes the issues by forcing scanAlerts to receive an input interface. Fixes #582
This commit is contained in:
parent
4aebe42ab7
commit
95a4618c17
4 changed files with 35 additions and 30 deletions
|
|
@ -479,28 +479,25 @@ end
|
|||
|
||||
-- #################################
|
||||
|
||||
function scanAlerts(granularity)
|
||||
local ifnames = interface.getIfNames()
|
||||
for _,ifname in pairs(ifnames) do
|
||||
if(verbose) then print("[minute.lua] Processing interface " .. ifname.."<p>\n") end
|
||||
function scanAlerts(granularity, ifname)
|
||||
if(verbose) then print("[minute.lua] Scanning ".. granularity .." alerts for interface " .. ifname.."<p>\n") end
|
||||
|
||||
check_interface_threshold(ifname, granularity)
|
||||
check_networks_threshold(ifname, granularity)
|
||||
-- host alerts checks
|
||||
local hash_key = "ntopng.prefs.alerts_"..granularity
|
||||
local hosts = ntop.getHashKeysCache(hash_key)
|
||||
if(hosts ~= nil) then
|
||||
for h in pairs(hosts) do
|
||||
if(verbose) then print("[minute.lua] Checking host " .. h.." alerts<p>\n") end
|
||||
check_host_threshold(ifname, h, granularity)
|
||||
end
|
||||
end
|
||||
-- network alerts checks
|
||||
if(networks ~= nil) then
|
||||
for n in pairs(networks) do
|
||||
if(verbose) then print("[minute.lua] Checking network " .. h.." alerts<p>\n") end
|
||||
end
|
||||
end
|
||||
end -- interfaces
|
||||
check_interface_threshold(ifname, granularity)
|
||||
check_networks_threshold(ifname, granularity)
|
||||
-- host alerts checks
|
||||
local hash_key = "ntopng.prefs.alerts_"..granularity
|
||||
local hosts = ntop.getHashKeysCache(hash_key)
|
||||
if(hosts ~= nil) then
|
||||
for h in pairs(hosts) do
|
||||
if(verbose) then print("[minute.lua] Checking host " .. h.." alerts<p>\n") end
|
||||
check_host_threshold(ifname, h, granularity)
|
||||
end
|
||||
end
|
||||
-- network alerts checks
|
||||
if(networks ~= nil) then
|
||||
for n in pairs(networks) do
|
||||
if(verbose) then print("[minute.lua] Checking network " .. h.." alerts<p>\n") end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue