mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
Implement countries serialization
Countries now show the cumulative traffic since ntopng restart as this is consistent with the other views
This commit is contained in:
parent
c09199690f
commit
8fcce457c9
18 changed files with 313 additions and 45 deletions
27
scripts/lua/get_country_data.lua
Normal file
27
scripts/lua/get_country_data.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
--
|
||||
-- (C) 2013-19 - ntop.org
|
||||
--
|
||||
|
||||
dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require "lua_utils"
|
||||
require "country_utils"
|
||||
local json = require("dkjson")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
-- sendHTTPHeader('application/json')
|
||||
interface.select(ifname)
|
||||
|
||||
local country = _GET["country"]
|
||||
|
||||
interface.select(ifname)
|
||||
|
||||
local country = interface.getCountryInfo(country)
|
||||
|
||||
local res = {}
|
||||
if country ~= nil then
|
||||
res = country2record(getInterfaceId(ifname), country)
|
||||
end
|
||||
|
||||
print(json.encode(res, nil))
|
||||
Loading…
Add table
Add a link
Reference in a new issue