mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
New pro charts features and timeseries api (#1865)
* 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
This commit is contained in:
parent
2c641cf286
commit
4cbe45a948
54 changed files with 5579 additions and 1765 deletions
|
|
@ -7,14 +7,14 @@ require "rrd_utils"
|
|||
|
||||
local os_utils = require "os_utils"
|
||||
local top_talkers_utils = require "top_talkers_utils"
|
||||
local ts_utils = require("ts_utils")
|
||||
local ts_utils = require("ts_utils_core")
|
||||
require("ts_minute")
|
||||
|
||||
local rrd_dump = {}
|
||||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.iface_update_ndpi_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
function rrd_dump.iface_update_ndpi_rrds(when, _ifname, ifstats, verbose)
|
||||
for k in pairs(ifstats["ndpi"]) do
|
||||
local v = ifstats["ndpi"][k]["bytes.sent"]+ifstats["ndpi"][k]["bytes.rcvd"]
|
||||
if(verbose) then print("["..__FILE__()..":"..__LINE__().."] ".._ifname..": "..k.."="..v.."\n") end
|
||||
|
|
@ -25,7 +25,7 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.iface_update_categories_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
function rrd_dump.iface_update_categories_rrds(when, _ifname, ifstats, verbose)
|
||||
for k, v in pairs(ifstats["ndpi_categories"]) do
|
||||
v = v["bytes"]
|
||||
if(verbose) then print("["..__FILE__()..":"..__LINE__().."] ".._ifname..": "..k.."="..v.."\n") end
|
||||
|
|
@ -36,7 +36,7 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.iface_update_stats_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
function rrd_dump.iface_update_stats_rrds(when, _ifname, ifstats, verbose)
|
||||
-- IN/OUT counters
|
||||
if(ifstats["localstats"]["bytes"]["local2remote"] > 0) then
|
||||
ts_utils.append("iface:local2remote", {ifid=ifstats.id, bytes=ifstats["localstats"]["bytes"]["local2remote"]}, when, verbose)
|
||||
|
|
@ -49,17 +49,10 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.subnet_update_rrds(when, ifstats, basedir, verbose)
|
||||
local basedir = os_utils.fixPath(dirs.workingdir .. "/" .. ifstats.id..'/subnetstats')
|
||||
function rrd_dump.subnet_update_rrds(when, ifstats, verbose)
|
||||
local subnet_stats = interface.getNetworksStats()
|
||||
|
||||
for subnet,sstats in pairs(subnet_stats) do
|
||||
local rrdpath = getPathFromKey(subnet)
|
||||
rrdpath = os_utils.fixPath(basedir.. "/" .. rrdpath)
|
||||
if(not(ntop.exists(rrdpath))) then
|
||||
ntop.mkdir(rrdpath)
|
||||
end
|
||||
|
||||
ts_utils.append("subnet:traffic", {ifid=ifstats.id, subnet=subnet,
|
||||
bytes_ingress=sstats["ingress"], bytes_egress=sstats["egress"],
|
||||
bytes_inner=sstats["inner"]}, when)
|
||||
|
|
@ -72,7 +65,7 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.iface_update_general_stats(when, ifstats, basedir, verbose)
|
||||
function rrd_dump.iface_update_general_stats(when, ifstats, verbose)
|
||||
-- General stats
|
||||
ts_utils.append("iface:hosts", {ifid=ifstats.id, num_hosts=ifstats.stats.hosts}, when, verbose)
|
||||
ts_utils.append("iface:devices", {ifid=ifstats.id, num_devices=ifstats.stats.devices}, when, verbose)
|
||||
|
|
@ -80,13 +73,13 @@ function rrd_dump.iface_update_general_stats(when, ifstats, basedir, verbose)
|
|||
ts_utils.append("iface:http_hosts", {ifid=ifstats.id, num_hosts=ifstats.stats.http_hosts}, when, verbose)
|
||||
end
|
||||
|
||||
function rrd_dump.iface_update_tcp_stats(when, ifstats, basedir, verbose)
|
||||
function rrd_dump.iface_update_tcp_stats(when, ifstats, verbose)
|
||||
ts_utils.append("iface:tcp_retransmissions", {ifid=ifstats.id, packets=ifstats.tcpPacketStats.retransmissions}, when, verbose)
|
||||
ts_utils.append("iface:tcp_out_of_order", {ifid=ifstats.id, packets=ifstats.tcpPacketStats.out_of_order}, when, verbose)
|
||||
ts_utils.append("iface:tcp_lost", {ifid=ifstats.id, packets=ifstats.tcpPacketStats.lost}, when, verbose)
|
||||
end
|
||||
|
||||
function rrd_dump.iface_update_tcp_flags(when, ifstats, basedir, verbose)
|
||||
function rrd_dump.iface_update_tcp_flags(when, ifstats, verbose)
|
||||
ts_utils.append("iface:tcp_syn", {ifid=ifstats.id, packets=ifstats.pktSizeDistribution.syn}, when, verbose)
|
||||
ts_utils.append("iface:tcp_synack", {ifid=ifstats.id, packets=ifstats.pktSizeDistribution.synack}, when, verbose)
|
||||
ts_utils.append("iface:tcp_finack", {ifid=ifstats.id, packets=ifstats.pktSizeDistribution.finack}, when, verbose)
|
||||
|
|
@ -95,9 +88,7 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function rrd_dump.profiles_update_stats(when, ifstats, basedir, verbose)
|
||||
local basedir = os_utils.fixPath(dirs.workingdir .. "/" .. ifstats.id..'/profilestats')
|
||||
|
||||
function rrd_dump.profiles_update_stats(when, ifstats, verbose)
|
||||
for pname, ptraffic in pairs(ifstats.profiles) do
|
||||
ts_utils.append("profile:traffic", {ifid=ifstats.id, profile=pname, bytes=ptraffic}, when, verbose)
|
||||
end
|
||||
|
|
@ -127,35 +118,32 @@ function rrd_dump.run_min_dump(_ifname, ifstats, config, when, verbose)
|
|||
return
|
||||
end
|
||||
|
||||
local basedir = os_utils.fixPath(dirs.workingdir .. "/" .. ifstats.id .. "/rrd")
|
||||
if not ntop.exists(basedir) then ntop.mkdir(basedir) end
|
||||
|
||||
rrd_dump.iface_update_stats_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
rrd_dump.iface_update_general_stats(when, ifstats, basedir, verbose)
|
||||
rrd_dump.iface_update_stats_rrds(when, _ifname, ifstats, verbose)
|
||||
rrd_dump.iface_update_general_stats(when, ifstats, verbose)
|
||||
|
||||
if config.interface_ndpi_timeseries_creation == "per_protocol" or config.interface_ndpi_timeseries_creation == "both" then
|
||||
rrd_dump.iface_update_ndpi_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
rrd_dump.iface_update_ndpi_rrds(when, _ifname, ifstats, verbose)
|
||||
end
|
||||
|
||||
if config.interface_ndpi_timeseries_creation == "per_category" or config.interface_ndpi_timeseries_creation == "both" then
|
||||
rrd_dump.iface_update_categories_rrds(when, basedir, _ifname, ifstats, verbose)
|
||||
rrd_dump.iface_update_categories_rrds(when, _ifname, ifstats, verbose)
|
||||
end
|
||||
|
||||
rrd_dump.subnet_update_rrds(when, ifstats, basedir, verbose)
|
||||
rrd_dump.subnet_update_rrds(when, ifstats, verbose)
|
||||
|
||||
-- TCP stats
|
||||
if config.tcp_retr_ooo_lost_rrd_creation == "1" then
|
||||
rrd_dump.iface_update_tcp_stats(when, ifstats, basedir, verbose)
|
||||
rrd_dump.iface_update_tcp_stats(when, ifstats, verbose)
|
||||
end
|
||||
|
||||
-- TCP Flags
|
||||
if config.tcp_flags_rrd_creation == "1" then
|
||||
rrd_dump.iface_update_tcp_flags(when, ifstats, basedir, verbose)
|
||||
rrd_dump.iface_update_tcp_flags(when, ifstats, verbose)
|
||||
end
|
||||
|
||||
-- Save Profile stats every minute
|
||||
if ntop.isPro() and ifstats.profiles then -- profiles are only available in the Pro version
|
||||
rrd_dump.profiles_update_stats(when, ifstats, basedir, verbose)
|
||||
rrd_dump.profiles_update_stats(when, ifstats, verbose)
|
||||
end
|
||||
|
||||
if ntop.isnEdge() and ifstats.type == "netfilter" and ifstats.netfilter then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue