Skip to content

Commit

Permalink
Added missing rest
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoBiscosi committed Oct 1, 2024
1 parent 51e2bea commit 21c5f92
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/lua/rest/v2/get/ntopng/limits.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--
-- (C) 2013-24 - ntop.org
--
local dirs = ntop.getDirs()

package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path

local rest_utils = require("rest_utils")

--
-- Return all the actively monitored ntopng interfaces along with their ids
-- Example: curl -u admin:admin -H "Content-Type: application/json" http://localhost:3000/lua/rest/v2/get/ntopng/interfaces.lua
--
-- NOTE: in case of invalid login, no error is returned but redirected to login
--

local rc = rest_utils.consts.success.ok
local res = {}

local limits = ntop.getLicenseLimits()

for limit, max in pairsByKeys(limits.max) do
res[#res + 1] = {
name = limit,
values = {{
current = limits.current[limit] or 0,
max = max
}}
}
end

rest_utils.answer(rc, res)

0 comments on commit 21c5f92

Please sign in to comment.