--
-- (C) 2017-24 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
package.path = dirs.installdir .. "/scripts/lua/modules/pools/?.lua;" ..
package.path
if (ntop.isPro()) then
package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" ..
package.path
local snmp_utils = require "snmp_utils"
shaper_utils = require "shaper_utils"
end
require "lua_utils"
local graph_utils = require "graph_utils"
local alert_utils = require "alert_utils"
local page_utils = require("page_utils")
local host_pools_nedge
if ntop.isnEdge() then host_pools_nedge = require "host_pools_nedge" end
local host_pools = require "host_pools"
-- Instantiate host pools
local host_pools_instance = host_pools:create()
local template = require "template_utils"
local have_nedge = ntop.isnEdge()
local pool_id = _GET["pool"]
local page = _GET["page"] or "historical"
if (not ntop.isPro()) then return end
if ifname == "__system__" then
-- Someone jumped from the users to the quotas in the System interface, redirect to a Network interface (e.g. nf:0)
local available_interfaces = interface.getIfNames()
ifname = available_interfaces["0"]
end
interface.select(ifname)
local ifstats = interface.getStats()
local ifId = ifstats.id
local pool_name = host_pools_instance:get_pool_name(pool_id)
if ntop.isnEdge() then
if _POST["reset_quotas"] ~= nil then
host_pools_nedge.resetPoolsQuotas(tonumber(pool_id))
end
end
sendHTTPContentTypeHeader('text/html')
page_utils.print_header_and_set_active_menu_entry(
page_utils.menu_entries.host_pools)
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
if (pool_id == nil) then
print(
"