Add preference to enable l7 total flow timeseries

This commit is contained in:
emanuele-f 2019-06-26 23:00:20 +02:00
parent b03e4b29cf
commit f9f341b2ca
9 changed files with 38 additions and 20 deletions

View file

@ -20,16 +20,13 @@ local ts_dump = {}
-- ########################################################
function ts_dump.iface_update_ndpi_rrds(when, _ifname, ifstats, verbose, config)
-- TODO add preference
config.ndpi_flows_timeseries_creation = true
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
ts_utils.append("iface:ndpi", {ifid=ifstats.id, protocol=k, bytes=v}, when, verbose)
if config.ndpi_flows_timeseries_creation then
if config.ndpi_flows_timeseries_creation == "1" then
ts_utils.append("iface:ndpi_flows", {ifid=ifstats.id, protocol=k, num_flows=ifstats["ndpi"][k]["num_flows"]}, when, verbose)
end
end
@ -279,6 +276,7 @@ function ts_dump.getConfig()
config.interface_ndpi_timeseries_creation = ntop.getPref("ntopng.prefs.interface_ndpi_timeseries_creation")
config.tcp_flags_rrd_creation = ntop.getPref("ntopng.prefs.tcp_flags_rrd_creation")
config.tcp_retr_ooo_lost_rrd_creation = ntop.getPref("ntopng.prefs.tcp_retr_ooo_lost_rrd_creation")
config.ndpi_flows_timeseries_creation = ntop.getPref("ntopng.prefs.ndpi_flows_rrd_creation")
-- Interface RRD creation is on, with per-protocol nDPI
if isEmptyString(config.interface_ndpi_timeseries_creation) then config.interface_ndpi_timeseries_creation = "per_protocol" end