mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 16:30:10 +00:00
added new pools
This commit is contained in:
parent
f8ef59e19d
commit
3b071dd046
6 changed files with 108 additions and 78 deletions
|
|
@ -10,25 +10,31 @@ require "lua_utils"
|
|||
local page_utils = require "page_utils"
|
||||
local json = require "dkjson"
|
||||
local template_utils = require "template_utils"
|
||||
local host_pools = require "host_pools"
|
||||
local interface_pools = require "interface_pools"
|
||||
local local_network_pools = require "local_network_pools"
|
||||
|
||||
local host_pools = require "host_pools"
|
||||
local flow_pools = require "flow_pools"
|
||||
local system_pools = require "system_pools"
|
||||
local device_pools = require "mac_pools"
|
||||
local interface_pools = require "interface_pools"
|
||||
local host_pool_pools = require "host_pool_pools"
|
||||
local local_network_pools = require "local_network_pools"
|
||||
local active_monitoring_pools = require "active_monitoring_pools"
|
||||
|
||||
local recipients = require "recipients"
|
||||
local recipients_instance = recipients:create()
|
||||
|
||||
local snmp_device_pools
|
||||
|
||||
local is_nedge = ntop.isnEdge()
|
||||
-- select the default page
|
||||
local page = _GET["page"] or (is_nedge and "active_monitoring" or "host")
|
||||
|
||||
-- load the snmp module only in the pro version
|
||||
if ntop.isPro() then
|
||||
snmp_device_pools = require "snmp_device_pools"
|
||||
end
|
||||
|
||||
local recipients = require "recipients"
|
||||
local recipients_instance = recipients:create()
|
||||
|
||||
-- *************** end of requires ***************
|
||||
|
||||
local is_nedge = ntop.isnEdge()
|
||||
-- select the default page
|
||||
local page = _GET["page"] or (is_nedge and "active_monitoring" or "host")
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
if not haveAdminPrivileges() then return end
|
||||
|
|
@ -44,39 +50,44 @@ if page == "snmp" and not ntop.isPro() then
|
|||
return
|
||||
end
|
||||
|
||||
|
||||
page_utils.print_page_title(i18n("pools.pools"))
|
||||
|
||||
-- ************************************* ------
|
||||
|
||||
local pool_type
|
||||
local pool_instance
|
||||
local pool_types = {
|
||||
|
||||
if page == "interface" then
|
||||
pool_instance = interface_pools:create()
|
||||
elseif page == "network" then
|
||||
pool_instance = local_network_pools:create()
|
||||
elseif page == "active_monitoring" then
|
||||
pool_instance = active_monitoring_pools:create()
|
||||
elseif page == "snmp" then
|
||||
pool_instance = snmp_device_pools:create()
|
||||
else
|
||||
pool_instance = host_pools:create()
|
||||
end
|
||||
-- Normal Pools
|
||||
["interface"] = interface_pools,
|
||||
["network"] = local_network_pools,
|
||||
["active_monitoring"] = active_monitoring_pools,
|
||||
["snmp"] = snmp_device_pools,
|
||||
["host"] = host_pools,
|
||||
|
||||
if page == "snmp" then
|
||||
pool_type = "snmp/device"
|
||||
else
|
||||
pool_type = page
|
||||
end
|
||||
-- Default Only Pools
|
||||
["host_pool"] = host_pool_pools,
|
||||
["flow"] = flow_pools,
|
||||
["system"] = system_pools,
|
||||
["mac"] = device_pools
|
||||
}
|
||||
|
||||
local pool_instance = pool_types[page]:create()
|
||||
local pool_type = (page == "snmp" and "snmp/device" or page)
|
||||
|
||||
local menu = {
|
||||
entries = {
|
||||
|
||||
-- Normal Pools
|
||||
{ key = "host", title = i18n("pools.pool_names.host"), url = "?page=host", hidden = is_nedge},
|
||||
{ key = "interface", title = i18n("pools.pool_names.interface"), url = "?page=interface", hidden = is_nedge},
|
||||
{ key = "network", title = i18n("pools.pool_names.local_network"), url = "?page=network", hidden = false},
|
||||
{ key = "snmp", title = i18n("pools.pool_names.snmp"), url = "?page=snmp", hidden = (not ntop.isPro() or is_nedge)},
|
||||
{ key = "active_monitoring", title = i18n("pools.pool_names.active_monitoring"), url = "?page=active_monitoring", hidden = false },
|
||||
|
||||
-- Default Only Pools
|
||||
{ key = "host_pool", title = i18n("pools.pool_names.host_pool_pool"), url = "?page=host_pool", hidden = false},
|
||||
{ key = "flow", title = i18n("pools.pool_names.flows"), url = "?page=flow", hidden = false},
|
||||
{ key = "mac", title = i18n("pools.pool_names.devices"), url = "?page=mac", hidden = false},
|
||||
{ key = "system", title = i18n("pools.pool_names.system"), url = "?page=system", hidden = false}
|
||||
},
|
||||
current_page = page
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue