Network discovery script is now enabled only is preferences are set to on

This commit is contained in:
Luca Deri 2024-05-26 21:26:37 +02:00
parent e57f35e4c7
commit f144d97b75

View file

@ -1,29 +1,31 @@
--
-- (C) 2013-24 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local discover_utils = require "discover_utils"
local callback_utils = require "callback_utils"
-- ########################################################
if(ntop.limitResourcesUsage()) then return end
-- ########################################################
local prefs = ntop.getPrefs()
local ifnames = interface.getIfNames()
-- ########################################################
local oneshot_discovery_condition = function(ifId)
local check_requested = discover_utils.networkDiscoveryRequested(ifId)
return check_requested
if(prefs.active_monitoring == true) then
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local discover_utils = require "discover_utils"
local callback_utils = require "callback_utils"
-- ########################################################
local ifnames = interface.getIfNames()
-- ########################################################
local oneshot_discovery_condition = function(ifId)
local check_requested = discover_utils.networkDiscoveryRequested(ifId)
return check_requested
end
-- ########################################################
-- discovery requests performed by the user from the GUI
callback_utils.foreachInterface(ifnames, oneshot_discovery_condition, discover_utils.discovery_function)
end
-- ########################################################
-- discovery requests performed by the user from the GUI
callback_utils.foreachInterface(ifnames, oneshot_discovery_condition, discover_utils.discovery_function)