Storage status in the interface page (rrd, flows index, pcap)

recording_utils.storageInfo now returns everything in bytes
Added getFolderSize to lua utils
Added rrd_utils.storageInfo
This commit is contained in:
Alfredo Cardigliano 2018-12-12 14:44:41 +01:00
parent 9e12db7cda
commit 931070804c
7 changed files with 112 additions and 27 deletions

View file

@ -1,5 +1,6 @@
local os_utils = require "os_utils"
require "lua_utils"
require "rrd_paths"
SECONDS_IN_A_HOUR = 3600
SECONDS_IN_A_DAY = SECONDS_IN_A_HOUR*24
@ -280,4 +281,23 @@ function rrd_interval_integrate(epoch_start, epoch_end, resolution, start, rawda
return times
end
-- ########################################################
-- Read information about the disk space used by rrd (size is in bytes)
function rrd_utils.storageInfo(ifid)
local dirs = ntop.getDirs()
local paths = getRRDPaths()
local info = { total = 0 }
for _, path in pairs(paths) do
local absolute_path = os_utils.fixPath(dirs.workingdir .. "/" .. ifid .. "/".. path .."/")
info[path] = getFolderSize(absolute_path)
info["total"] = info["total"] + info[path]
end
return info
end
-- ########################################################
return rrd_utils