mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Removed useless requires for enchanting performances
Removed, where it was possible, the lua requires, with the objective of enchanting the performances of periodic activities
This commit is contained in:
parent
8453fb6e6d
commit
c62c2c232e
9 changed files with 114 additions and 39 deletions
|
|
@ -1,14 +1,58 @@
|
|||
--
|
||||
-- (C) 2014-21 - ntop.org
|
||||
--
|
||||
-- Absolutely don't put require inside this file.
|
||||
-- It is born to do fast checks, to avoid slowing down
|
||||
-- periodics checks and callbacks.
|
||||
--
|
||||
|
||||
scripts_triggers = {}
|
||||
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.aggregateHttp()
|
||||
if (ntop.getCache("ntopng.prefs.http_traffic_dump")) then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function midnightStatsResetEnabled()
|
||||
if (ntop.getPref("ntopng.prefs.midnight_stats_reset_enabled") == "1") then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.isDumbFlowToSQLEnabled(ifstats)
|
||||
if (ntop.getPrefs()["is_dump_flows_to_mysql_enabled"] and not ifstats.isViewed) then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.isDeltaSet()
|
||||
if (ntop.getPref("ntopng.prefs.enable_ts_deltas_writes") == "1") then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.isRecordingAvailable()
|
||||
local is_available_key = "ntopng.cache.traffic_recording_available"
|
||||
|
||||
if(ntop.isAdministrator() and (ntop.getCache(is_available_key) == "1")) then
|
||||
return true
|
||||
end
|
||||
|
|
@ -18,6 +62,37 @@ end
|
|||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.isRrdCreationEnabled()
|
||||
if(ntop.getPref("ntopng.prefs.internals_rrd_creation") == "1") then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.isRrdInterfaceCreation()
|
||||
if(ntop.getPref("ntopng.prefs.interface_rrd_creation") ~= "0") then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.hasHighResolutionTs()
|
||||
local active_driver = ntop.getPref("ntopng.prefs.timeseries_driver")
|
||||
|
||||
-- High resolution timeseries means dumping the host timeseries
|
||||
-- every 60 seconds instead of 300 seconds.
|
||||
return((active_driver == "influxdb") and
|
||||
(ntop.getPref("ntopng.prefs.ts_resolution") ~= "300"))
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function scripts_triggers.checkReloadLists()
|
||||
if((ntop.getCache("ntopng.cache.download_lists_utils") == "1") or (ntop.getCache("ntopng.cache.reload_lists_utils") == "1")) then
|
||||
return(true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue