mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Implements stats rather than grouped hosts data for host pools stats
This commit is contained in:
parent
9f482f612f
commit
3413a6afd0
12 changed files with 518 additions and 164 deletions
|
|
@ -535,6 +535,38 @@ function host_pools_utils.updateRRDs(ifid, dump_ndpi, verbose)
|
|||
end
|
||||
end
|
||||
|
||||
function host_pools_utils.hostpool2record(ifid, pool_id, pool)
|
||||
local record = {}
|
||||
record["key"] = tostring(pool_id)
|
||||
|
||||
local pool_name = host_pools_utils.getPoolName(ifid, pool_id)
|
||||
local pool_link = "<A HREF='"..ntop.getHttpPrefix()..'/lua/hosts_stats.lua?pool='..pool_id.."' title='"..pool_name.."'>"..pool_name..'</A>'
|
||||
record["column_id"] = pool_link
|
||||
|
||||
record["column_hosts"] = pool["num_hosts"]..""
|
||||
record["column_since"] = secondsToTime(os.time() - pool["seen.first"] + 1)
|
||||
|
||||
local sent2rcvd = round((pool["bytes.sent"] * 100) / (pool["bytes.sent"] + pool["bytes.rcvd"]), 0)
|
||||
record["column_breakdown"] = "<div class='progress'><div class='progress-bar progress-bar-warning' style='width: "
|
||||
.. sent2rcvd .."%;'>Sent</div><div class='progress-bar progress-bar-info' style='width: " .. (100-sent2rcvd) .. "%;'>Rcvd</div></div>"
|
||||
|
||||
if(throughput_type == "pps") then
|
||||
record["column_thpt"] = pktsToSize(pool["throughput_pps"])
|
||||
else
|
||||
record["column_thpt"] = bitsToSize(8*pool["throughput_bps"])
|
||||
end
|
||||
|
||||
record["column_traffic"] = bytesToSize(pool["bytes.sent"] + pool["bytes.rcvd"])
|
||||
|
||||
record["column_chart"] = ""
|
||||
|
||||
if ntop.getCache("ntopng.prefs.host_pools_rrd_creation") == "1" then
|
||||
record["column_chart"] = '<A HREF="'..ntop.getHttpPrefix()..'/lua/pool_details.lua?pool='..pool_id..'&page=historical"><i class=\'fa fa-area-chart fa-lg\'></i></A>'
|
||||
end
|
||||
|
||||
return record
|
||||
end
|
||||
|
||||
function host_pools_utils.printQuotas(pool_id, host, page_params)
|
||||
local pools_stats = interface.getHostPoolsStats()
|
||||
local pool_stats = pools_stats and pools_stats[tonumber(pool_id)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue