mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Improves JSON data retrieval for historical top talkers
This commit is contained in:
parent
e8a3d43065
commit
7b2057eaec
2 changed files with 42 additions and 25 deletions
|
|
@ -248,13 +248,26 @@ local function getHistoricalTopTalkersInInterval(ifid, ifname, epoch_start, epoc
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
::next_vlan::
|
||||
end
|
||||
::next_record::
|
||||
end
|
||||
-- tprint(res)
|
||||
return json.encode(res, nil)
|
||||
-- reformat the output so that it becomes easier to parse
|
||||
local pretty_res = {}
|
||||
for direction, hosts in pairs(res) do
|
||||
local t = {}
|
||||
for addr, traffic in pairs(hosts) do
|
||||
table.insert(pretty_res, {["addr"] = addr, ["bytes"] = traffic, ["direction"] = direction})
|
||||
end
|
||||
end
|
||||
res = pretty_res
|
||||
return res
|
||||
end
|
||||
|
||||
top_talkers_intf.name = "Top Talkers"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue