ntopng/scripts/lua/get_country_data.lua
emanuele-f 8fcce457c9 Implement countries serialization
Countries now show the cumulative traffic since ntopng restart as this is consistent with the other views
2019-05-27 13:07:30 +02:00

27 lines
554 B
Lua

--
-- (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))