Enable HostPools statistics dump and quota for Not Assigned pool.

This commit is contained in:
emanuele-f 2017-04-03 12:33:20 +02:00
parent 076bb05450
commit d8d0d4e381
6 changed files with 41 additions and 44 deletions

View file

@ -222,28 +222,24 @@ end
function host_pools_utils.updateRRDs(ifid, dump_ndpi, verbose)
-- NOTE: requires graph_utils
for pool_id, pool_stats in pairs(interface.getHostPoolsStats()) do
-- possibly skip the default pool (it should not be there anyway)
if pool_id ~= host_pools_utils.DEFAULT_POOL_ID then
local pool_base = host_pools_utils.getRRDBase(ifid, pool_id)
local pool_base = host_pools_utils.getRRDBase(ifid, pool_id)
if(not(ntop.exists(pool_base))) then
ntop.mkdir(pool_base)
end
if(not(ntop.exists(pool_base))) then
ntop.mkdir(pool_base)
end
-- Traffic stats
local rrdpath = fixPath(pool_base .. "/bytes.rrd")
createRRDcounter(rrdpath, 300, verbose)
ntop.rrd_update(rrdpath, "N:"..tolongint(pool_stats["bytes.sent"]) .. ":" .. tolongint(pool_stats["bytes.rcvd"]))
-- Traffic stats
local rrdpath = fixPath(pool_base .. "/bytes.rrd")
createRRDcounter(rrdpath, 300, verbose)
ntop.rrd_update(rrdpath, "N:"..tolongint(pool_stats["bytes.sent"]) .. ":" .. tolongint(pool_stats["bytes.rcvd"]))
-- nDPI stats
if dump_ndpi then
for proto,v in pairs(pool_stats["ndpi"] or {}) do
local ndpiname = fixPath(pool_base.."/"..proto..".rrd")
createRRDcounter(ndpiname, 300, verbose)
ntop.rrd_update(ndpiname, "N:"..tolongint(v["bytes.sent"])..":"..tolongint(v["bytes.rcvd"]))
end
-- nDPI stats
if dump_ndpi then
for proto,v in pairs(pool_stats["ndpi"] or {}) do
local ndpiname = fixPath(pool_base.."/"..proto..".rrd")
createRRDcounter(ndpiname, 300, verbose)
ntop.rrd_update(ndpiname, "N:"..tolongint(v["bytes.sent"])..":"..tolongint(v["bytes.rcvd"]))
end
end
end