mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
Unifies flows, timeseries and top-talkers data retention
Implements #2897
This commit is contained in:
parent
359599c4eb
commit
aa652145d0
8 changed files with 75 additions and 80 deletions
30
scripts/lua/modules/data_retention_utils.lua
Normal file
30
scripts/lua/modules/data_retention_utils.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--
|
||||
-- (C) 2014-19 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
|
||||
local DEFAULT_DATA_RETENTION_DAYS = 30
|
||||
local DATA_RETENTION_DAYS_KEY = "ntopng.prefs.data_retention_days"
|
||||
|
||||
local data_retention_utils = {}
|
||||
|
||||
-- ########################################################
|
||||
|
||||
function data_retention_utils.getDefaultRetention()
|
||||
return DEFAULT_DATA_RETENTION_DAYS
|
||||
end
|
||||
|
||||
-- ########################################################
|
||||
|
||||
function data_retention_utils.getDataRetentionDays()
|
||||
local data_retention = ntop.getCache(DATA_RETENTION_DAYS_KEY)
|
||||
|
||||
return tonumber(data_retention) or data_retention_utils.getDefaultRetention()
|
||||
end
|
||||
|
||||
-- ########################################################
|
||||
|
||||
return data_retention_utils
|
||||
Loading…
Add table
Add a link
Reference in a new issue