mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Added new flows page
This commit is contained in:
parent
1e501e26bb
commit
4c057cf8fd
7 changed files with 444 additions and 205 deletions
44
scripts/lua/rest/v2/get/flow/aggregated_live_flows.lua
Normal file
44
scripts/lua/rest/v2/get/flow/aggregated_live_flows.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
--
|
||||
-- (C) 2013-23 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
local rest_utils = require("rest_utils")
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
local res = {}
|
||||
|
||||
local ifid = _GET["ifid"]
|
||||
|
||||
if isEmptyString(ifid) then
|
||||
rc = rest_utils.consts.err.invalid_interface
|
||||
rest_utils.answer(rc)
|
||||
return
|
||||
end
|
||||
|
||||
interface.select(ifid)
|
||||
|
||||
local aggregated_info = interface.getProtocolFlowsStats()
|
||||
|
||||
for _, data in pairs(aggregated_info) do
|
||||
res[#res + 1] = {
|
||||
flows = data.num_flows,
|
||||
application = {
|
||||
label = data.proto_name,
|
||||
id = data.proto_id,
|
||||
},
|
||||
bytes_rcvd = data.bytes_rcvd,
|
||||
bytes_sent = data.bytes_sent,
|
||||
tot_traffic = data.bytes_sent + data.bytes_rcvd,
|
||||
num_servers = data.num_servers,
|
||||
num_clients = data.num_clients,
|
||||
vlan_id = {
|
||||
id = data.vlan_id,
|
||||
label = data.vlan_id
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
rest_utils.answer(rc, res)
|
||||
Loading…
Add table
Add a link
Reference in a new issue