mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Improved storage utilization bar
This commit is contained in:
parent
b7da5b2840
commit
b29894d9bb
4 changed files with 78 additions and 37 deletions
|
|
@ -21,7 +21,7 @@ local storage_utils = {}
|
|||
-- #################################
|
||||
|
||||
function storage_utils.interfaceStorageInfo(ifid)
|
||||
local info = { total = 0}
|
||||
local info = { total = 0 }
|
||||
local key = "ntopng.cache."..ifid..".storage_info"
|
||||
|
||||
local info_json = ntop.getCache(key)
|
||||
|
|
@ -47,7 +47,9 @@ function storage_utils.interfaceStorageInfo(ifid)
|
|||
local pcap_storage_info = recording_utils.storageInfo(ifid)
|
||||
local total_pcap_dump_used = (pcap_storage_info.if_used + pcap_storage_info.extraction_used)
|
||||
info["pcap"] = total_pcap_dump_used
|
||||
info["total"] = info["total"] + total_pcap_dump_used
|
||||
if dirs.pcapdir == dirs.workingdir then
|
||||
info["total"] = info["total"] + total_pcap_dump_used
|
||||
end
|
||||
end
|
||||
-- end
|
||||
|
||||
|
|
@ -61,15 +63,25 @@ end
|
|||
|
||||
function storage_utils.storageInfo()
|
||||
local ifnames = interface.getIfNames()
|
||||
local info = { total = 0, interfaces = {} }
|
||||
local info = { total = 0, pcap_total = 0, interfaces = {} }
|
||||
|
||||
for id, name in pairs(ifnames) do
|
||||
local ifid = tonumber(id)
|
||||
local if_info = storage_utils.interfaceStorageInfo(ifid)
|
||||
info.interfaces[ifid] = if_info
|
||||
info.total = info.total + if_info.total
|
||||
if if_info.pcap ~= nil then
|
||||
info.pcap_total = info.pcap_total + if_info.pcap
|
||||
end
|
||||
end
|
||||
|
||||
local volume_info = recording_utils.volumeInfo(dirs.workingdir)
|
||||
info.system = volume_info.used - info.total
|
||||
info.avail = volume_info.avail
|
||||
info.volume_size = volume_info.total
|
||||
info.volume_mount = volume_info.mount
|
||||
info.volume_dev = volume_info.dev
|
||||
|
||||
return info
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue