Replace getFlowPeers function with getFlows and limit results to reduce memory footprint.

This commit is contained in:
emanuele-f 2017-01-25 16:23:47 +01:00 committed by Simone Mainardi
parent 096db1085d
commit 1598598c47
12 changed files with 61 additions and 578 deletions

View file

@ -2723,3 +2723,20 @@ function isCaptivePortalActive(ifstats)
return is_bridge_iface and is_captive_portal_enabled
end
function getTopFlowPeers(hostname_vlan, max_hits, detailed)
local detailed = detailed or false
local paginator_options = {
sortColumn = "column_bytes",
detailedResults = detailed,
maxHits = max_hits,
}
local res = interface.getFlowsInfo(hostname_vlan, paginator_options)
if ((res ~= nil) and (res.flows ~= nil)) then
return res.flows
else
return {}
end
end