mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Adds VLANs lua getters
This commit is contained in:
parent
2873438712
commit
c8c4505d9c
3 changed files with 147 additions and 0 deletions
27
scripts/lua/get_vlan_data.lua
Normal file
27
scripts/lua/get_vlan_data.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
--
|
||||
-- (C) 2013-17 - ntop.org
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "lua_utils"
|
||||
require "vlan_utils"
|
||||
local json = require("dkjson")
|
||||
|
||||
sendHTTPHeader('text/html; charset=iso-8859-1')
|
||||
|
||||
-- sendHTTPHeader('application/json')
|
||||
interface.select(ifname)
|
||||
|
||||
local vlan_id = tonumber(_GET["vlan"])
|
||||
|
||||
interface.select(ifname)
|
||||
|
||||
local vlan = interface.getVLANInfo(vlan_id)
|
||||
|
||||
local res = {}
|
||||
if vlan ~= nil then
|
||||
res = vlan2record(vlan)
|
||||
end
|
||||
|
||||
print(json.encode(res, nil))
|
||||
Loading…
Add table
Add a link
Reference in a new issue