mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Updated host configuration page
This commit is contained in:
parent
a3c32acf23
commit
e25e417ba1
8 changed files with 332 additions and 131 deletions
37
scripts/lua/rest/v2/get/host/config.lua
Normal file
37
scripts/lua/rest/v2/get/host/config.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
--
|
||||
-- (C) 2013-21 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "label_utils"
|
||||
require "lua_utils_get"
|
||||
require "lua_utils_gui"
|
||||
local rest_utils = require "rest_utils"
|
||||
local host_info = url2hostinfo(_GET)
|
||||
|
||||
if not isAdministrator() then
|
||||
rest_utils.answer(rest_utils.consts.err.not_found)
|
||||
return
|
||||
end
|
||||
|
||||
if isEmptyString(host_info.host) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_host)
|
||||
return
|
||||
end
|
||||
|
||||
local host = interface.getHostInfo(host_info["host"], host_info["vlan"])
|
||||
local ifstats = interface.getStats()
|
||||
local host_key = hostinfo2hostkey(host_info)
|
||||
|
||||
local rsp = {
|
||||
alias = getHostAltName(host_info),
|
||||
notes = getHostNotes(host_info),
|
||||
host_pool_id = host["host_pool_id"],
|
||||
has_traffic_policies = ifstats.inline and (host.localhost or host.systemhost),
|
||||
drop_traffic = ntop.getHashCache("ntopng.prefs.drop_host_traffic", host_key)
|
||||
}
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
rest_utils.answer(rc, rsp)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue