mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Add v1/get/interface REST API
This commit is contained in:
parent
db7fc18466
commit
5ebd5ad5c1
4 changed files with 268 additions and 6 deletions
|
|
@ -17,6 +17,10 @@ local rest_utils = require("rest_utils")
|
|||
-- NOTE: in case of invalid login, no error is returned but redirected to login
|
||||
--
|
||||
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
local rc = rest_utils.consts_ok
|
||||
local res = {}
|
||||
|
||||
-- whether to return host statistics: on by default
|
||||
local host_stats = _GET["host_stats"]
|
||||
|
|
@ -26,7 +30,6 @@ local host_stats_flows = _GET["host_stats_flows"]
|
|||
local host_stats_flows_num = _GET["limit"]
|
||||
|
||||
local host_info = url2hostinfo(_GET)
|
||||
local rc = rest_utils.consts_ok
|
||||
|
||||
local function flows2protocolthpt(flows)
|
||||
local protocol_thpt = {}
|
||||
|
|
@ -58,7 +61,7 @@ end
|
|||
local ifid = _GET["ifid"]
|
||||
-- parse interface names and possibly fall back to the selected interface:
|
||||
-- priority goes to the interface id
|
||||
if ifid ~= nil and ifid ~= "" then
|
||||
if not isEmptyString(ifid) then
|
||||
if_name = getInterfaceName(ifid)
|
||||
-- finally, we fall back to the default selected interface name
|
||||
else
|
||||
|
|
@ -66,10 +69,6 @@ else
|
|||
return
|
||||
end
|
||||
|
||||
local res = {}
|
||||
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
if host_info["host"] then
|
||||
interface.select(if_name)
|
||||
local host = interface.getHostInfo(host_info["host"], host_info["vlan"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue