mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fixes AS stats in the GUI
This commit is contained in:
parent
a63eeadbb1
commit
a43636bdb0
6 changed files with 119 additions and 19 deletions
27
scripts/lua/get_as_data.lua
Normal file
27
scripts/lua/get_as_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 "as_utils" -- needed for the function mac2record
|
||||
local json = require("dkjson")
|
||||
|
||||
sendHTTPHeader('text/html; charset=iso-8859-1')
|
||||
|
||||
-- sendHTTPHeader('application/json')
|
||||
interface.select(ifname)
|
||||
|
||||
local asn = tonumber(_GET["asn"])
|
||||
|
||||
interface.select(ifname)
|
||||
|
||||
local as = interface.getASInfo(asn)
|
||||
|
||||
local res = {}
|
||||
if as ~= nil then
|
||||
res = as2record(as)
|
||||
end
|
||||
|
||||
print(json.encode(res, nil))
|
||||
Loading…
Add table
Add a link
Reference in a new issue