mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 19:15:03 +00:00
Moved active local host caching into periodic host check
This commit is contained in:
parent
f12f4d1fa8
commit
4a1b2b758c
2 changed files with 0 additions and 1 deletions
26
attic/scripts/callbacks/interface/localhosts_stats.lua
Normal file
26
attic/scripts/callbacks/interface/localhosts_stats.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--
|
||||
-- (C) 2013-23 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
-- ########################################################
|
||||
|
||||
local prefs = ntop.getPrefs()
|
||||
|
||||
-- ########################################################
|
||||
|
||||
-- when the active local hosts cache is enabled, ntopng periodically dumps active local hosts statistics to redis
|
||||
-- in order to protect from failures (e.g., power losses)
|
||||
if prefs.is_active_local_hosts_cache_enabled then
|
||||
local interval = prefs.active_local_hosts_cache_interval
|
||||
local when = os.time()
|
||||
local diff = when % tonumber((interval or 3600 --[[ default 1 h --]]))
|
||||
|
||||
if diff < 60 then
|
||||
-- to protect from failures (e.g., power losses) it is possible to save
|
||||
-- local hosts counters to redis once per hour
|
||||
interface.dumpLocalHosts2redis()
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue