Fixes local networks aggregation functions

Local networks are aggregated on the basis of their string representation
rather than their id which may change between ntopng restarts.
This commit is contained in:
Simone Mainardi 2016-03-11 18:30:42 +01:00
parent 97c45aef96
commit 6c5f665a73

View file

@ -60,7 +60,7 @@ local function topNetworksSectionInTableOP(tblarray, arithOp)
local found = false
if (ret[outer_cnt][key] == nil) then ret[outer_cnt][key] = {} end
for _,el in pairs(ret[outer_cnt][key]) do
if (found == false and el["address"] == record["address"]) then
if (found == false and el["label"] == record["label"]) then
el["value"] = arithOp(el["value"], record["value"])
found = true
end
@ -209,7 +209,7 @@ end
top_networks_intf.name = "Networks"
top_networks_intf.infoScript = "hosts_stats.lua"
top_networks_intf.infoScriptKey = "network"
top_networks_intf.key = "local_network_id"
top_networks_intf.key = "network"
top_networks_intf.JSONkey = "networks"
top_networks_intf.uniqueKey = "top_local_nets"
top_networks_intf.getTop = getTopNetworks