mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
migrated federation rest apis (#4056)
This commit is contained in:
parent
e03deb3416
commit
0673338183
5 changed files with 0 additions and 142 deletions
|
|
@ -1,29 +0,0 @@
|
|||
--
|
||||
-- (C) 2020 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local json = require("dkjson")
|
||||
local rest_utils = require("rest_utils")
|
||||
local tracker = require("tracker")
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
local res = {}
|
||||
|
||||
-- TODO: collect real statistics about the running ntopng instance
|
||||
res = {
|
||||
total_traffic = {up = 100, down = 100},
|
||||
host_number = 10,
|
||||
flow_number = 20,
|
||||
alert_number = 300,
|
||||
version = "v1"
|
||||
}
|
||||
|
||||
|
||||
local origin = _SERVER["origin"] or '*'
|
||||
local extra_headers = { 'Access-Control-Allow-Origin: '..origin }
|
||||
|
||||
rest_utils.answer(rc, res, extra_headers)
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
--
|
||||
-- (C) 2020 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local json = require("dkjson")
|
||||
local rest_utils = require("rest_utils")
|
||||
local tracker = require("tracker")
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
local res = {}
|
||||
|
||||
if not haveAdminPrivileges() then
|
||||
rest_utils.answer(rest_utils.consts.err.not_granted, res)
|
||||
return
|
||||
end
|
||||
|
||||
local id = _GET["id"]
|
||||
|
||||
if isEmptyString(id) then
|
||||
-- TODO: return all the instances
|
||||
res = {
|
||||
{id = 0, alias = "Firenze ntopng", user = "admin", token = "1e0c611168c63bc9bae9fd32cb269bdf", url = "http://ntopng.gabriele.it:3000"},
|
||||
{id = 1, alias = "Prato ntopng", user = "admin", token = "1e0c611168c63bc9bae9fd32cb269bdf", url = "http://ntopng.gabriele.it:3000"},
|
||||
{id = 2, alias = "Pisa ntopng", user = "admin", token = "1e0c611168c63bc9bae9fd32cb269bdf", url = "http://ntopng.gabriele.it:3000"},
|
||||
}
|
||||
else
|
||||
-- TODO: return the instance identified by the id
|
||||
res = {id = 0, alias = "Firenze ntopng", username = "admin", password = "gabriele", url = "http://ntopng.gabriele.it:3000"}
|
||||
end
|
||||
|
||||
rest_utils.answer(rc, res)
|
||||
Loading…
Add table
Add a link
Reference in a new issue