mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
* Integrate modified nvd3 library with zoom and multicharts working support * Fix count in RRD driver * Initial chart ajax migration * Update nvd3 with zoom stack support * Fix RRD listSeries with directories * Work in progress graphs * Compatibility fix * Initial support for schema based api * Add missing script * Fix listSeries for existance check * Implement topk timseries api * Implement topk queries and fix labels and formats * Migrate interface top sender and receivers * Migrate charts to new API * Move timeseries list for menu inside respective scripts * Add support for extended labels * Fix missing fields while chaning graph resolution Also Rename drawRRD in drawGraphs * Fix historical tabs * Add missing time fence in influx topk * Add graphs support for custom statistics visualization * Initial support for graphs statistics footer * Implement statistics in single graphs for RRD driver * Move sampling function into the driver and fix graph statistics * Fix max/min value offset * Implement influxdb sampling use built-in FILL * Implement stats and total serie in influxdb driver * Update nvd3 with multiChart fixes * Update nvd3 with new multiChart fixes * RRD driver fixes * Move metrics type from single metric to schema * Handle ajax errors and empty data in charts * Fix flow device interfaces graphs * Use timeserie label as timeseries dropdown text * Implement topk aggregation into one data serie * ts_utils module now provides all the schemas * Migrate ntop.exist(rrd) to ts_utils.exist * Fix timeseries dropdown label * L4 protos fixes for charts * Migrate getProtoVolume to new API * Integrate nvd3 fix for tooltip position * Initial community graphs migration to timseries API * Fix community timeseries dropdown and historical tabs * Hide total serie by default * Remove l4 protos from topk charts
42 lines
1.5 KiB
Lua
42 lines
1.5 KiB
Lua
require "lua_utils"
|
|
require "graph_utils"
|
|
local ts_utils = require "ts_utils"
|
|
|
|
-- Get from redis the throughput type bps or pps
|
|
local throughput_type = getThroughputType()
|
|
|
|
local now = os.time()
|
|
|
|
function as2record(ifId, as)
|
|
local record = {}
|
|
record["key"] = tostring(as["asn"])
|
|
|
|
local as_link = "<A HREF='"..ntop.getHttpPrefix()..'/lua/hosts_stats.lua?asn='..as["asn"].."' title='"..as["asname"].."'>"..as["asn"]..'</A>'
|
|
record["column_asn"] = as_link
|
|
|
|
record["column_asname"] = printASN(as["asn"], as["asname"])
|
|
|
|
record["column_hosts"] = as["num_hosts"]..""
|
|
record["column_since"] = secondsToTime(now - as["seen.first"] + 1)
|
|
|
|
local sent2rcvd = round((as["bytes.sent"] * 100) / (as["bytes.sent"] + as["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(as["throughput_pps"])
|
|
else
|
|
record["column_thpt"] = bitsToSize(8*as["throughput_bps"])
|
|
end
|
|
|
|
record["column_traffic"] = bytesToSize(as["bytes.sent"] + as["bytes.rcvd"])
|
|
|
|
record["column_chart"] = ""
|
|
|
|
if ts_utils.exists("asn:traffic", {ifid=ifId, asn=as["asn"]}) then
|
|
record["column_chart"] = '<A HREF="'..ntop.getHttpPrefix()..'/lua/as_details.lua?asn='..as["asn"]..'&page=historical"><i class=\'fa fa-area-chart fa-lg\'></i></A>'
|
|
end
|
|
|
|
return record
|
|
end
|
|
|