Add driver:deleteOldData and delete old RRDs

This commit is contained in:
emanuele-f 2018-12-10 17:41:41 +01:00
parent 773df632b4
commit 95713ddfc6
13 changed files with 125 additions and 89 deletions

View file

@ -698,4 +698,22 @@ end
-- ##############################################
function driver:deleteOldData(ifid)
local paths = getRRDPaths()
local dirs = ntop.getDirs()
local ifaces = ntop.listInterfaces()
local retention_days = tonumber(ntop.getPref("ntopng.prefs.old_rrd_files_retention")) or 365
tprint(retention_days)
for _, path in pairs(paths) do
local ifpath = os_utils.fixPath(dirs.workingdir .. "/" .. ifid .. "/".. path .."/")
ntop.deleteOldRRDs(ifpath, retention_days * 86400)
end
return true
end
-- ##############################################
return driver