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

@ -3404,6 +3404,28 @@ end
-- ###########################################
-- Returns the size of a folder (size is in bytes)
function getFolderSize(path)
local size = 0
if ntop.isWindows() then
-- TODO
else
local line = os_utils.execWithOutput("du -s "..path.." 2>/dev/null")
local values = split(line, '\t')
if #values >= 1 then
local used = tonumber(values[1])
if used ~= nil then
size = used*1024
end
end
end
return size
end
-- ###########################################
-- Compares IPv4 / IPv6 addresses
function ip_address_asc(a, b)
return(ntop.ipCmp(a, b) < 0)