From 2daaedb5edcc60a7de5ac0eff34435b5b5c33fdc Mon Sep 17 00:00:00 2001 From: MatteoBiscosi Date: Mon, 7 Nov 2022 18:30:43 +0100 Subject: [PATCH] Updated timeseries pages --- http_src/utilities/formatter-utils.js | 7 +++ http_src/utilities/metrics-manager.js | 60 +++++++++++++++++++++++++ scripts/locales/en.lua | 16 ++++--- scripts/lua/as_details.lua | 39 +--------------- scripts/lua/country_details.lua | 16 +------ scripts/lua/modules/timeseries_info.lua | 59 ++++++++++++++---------- scripts/lua/os_details.lua | 17 +------ scripts/lua/pool_details.lua | 21 +-------- scripts/lua/vlan_details.lua | 10 +---- 9 files changed, 122 insertions(+), 123 deletions(-) diff --git a/http_src/utilities/formatter-utils.js b/http_src/utilities/formatter-utils.js index 00b9ee6bc2..ffa2b04a95 100644 --- a/http_src/utilities/formatter-utils.js +++ b/http_src/utilities/formatter-utils.js @@ -51,6 +51,13 @@ const types = { decimal: 2, scale_values: null, }, + ms: { + id: "ms", + um: ["ms", "Kms", "Mms", "Gms", "Tms"], + step: 1000, + decimal: 2, + scale_values: null, + }, }; function getUnitMeasureLen(type) { diff --git a/http_src/utilities/metrics-manager.js b/http_src/utilities/metrics-manager.js index bb5c68567e..18755557b2 100644 --- a/http_src/utilities/metrics-manager.js +++ b/http_src/utilities/metrics-manager.js @@ -193,6 +193,66 @@ const sources_types = [ ui_type: ui_types.select_and_input, query: "subnet", }, + { + regex_page_url: "lua\/as_details", + label: "ASN", + disable_url: true, + value: "asn", + regex_type: "text", + sources_sub_url: "lua/rest/v2/get/ntopng/interfaces.lua", + sub_value: "ifid", + sub_label: "Interface", + ui_type: ui_types.select_and_input, + query: "asn", + }, + { + regex_page_url: "lua\/country_details", + label: "Country", + disable_url: true, + value: "country", + regex_type: "text", + sources_sub_url: "lua/rest/v2/get/ntopng/interfaces.lua", + sub_value: "ifid", + sub_label: "Interface", + ui_type: ui_types.select_and_input, + query: "country", + }, + { + regex_page_url: "lua\/os_details", + label: "OS", + disable_url: true, + value: "os", + regex_type: "text", + sources_sub_url: "lua/rest/v2/get/ntopng/interfaces.lua", + sub_value: "ifid", + sub_label: "Interface", + ui_type: ui_types.select_and_input, + query: "os", + }, + { + regex_page_url: "lua\/vlan_details", + label: "VLAN", + disable_url: true, + value: "vlan", + regex_type: "text", + sources_sub_url: "lua/rest/v2/get/ntopng/interfaces.lua", + sub_value: "ifid", + sub_label: "Interface", + ui_type: ui_types.select_and_input, + query: "vlan", + }, + { + regex_page_url: "lua\/pool_details", + label: "Host Pool", + disable_url: true, + value: "pool", + regex_type: "text", + sources_sub_url: "lua/rest/v2/get/ntopng/interfaces.lua", + sub_value: "ifid", + sub_label: "Interface", + ui_type: ui_types.select_and_input, + query: "host_pool", + }, ]; const get_source_type_from_value = (source_type_value) => { diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index dd1e76cedf..bb9acc7e4a 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -3323,12 +3323,12 @@ local lang = { ["host_unreachable_flows"] = "Total Host Unreachable Flows", ["hosts_anomalies"] = "Hosts Anomalies", ["http_stats"] = "HTTP Stats", - ["iface_active_local_hosts"] = "Active Local Hosts", - ["iface_score_anomalies"] = "Anomalies: Score", - ["iface_score_behavior"] = "Behaviour: Score", - ["iface_traffic_anomalies"] = "Anomalies: Traffic RX/TX", - ["iface_traffic_rx_behavior"] = "Behaviour: Traffic RX", - ["iface_traffic_tx_behavior"] = "Behaviour: Traffic TX", + ["active_local_hosts"] = "Active Local Hosts", + ["score_anomalies"] = "Anomalies: Score", + ["score_behavior"] = "Behaviour: Score", + ["traffic_anomalies"] = "Anomalies: Traffic RX/TX", + ["traffic_rx_behavior"] = "Behaviour: Traffic RX", + ["traffic_tx_behavior"] = "Behaviour: Traffic TX", ["influxdb_not_responding"] = "Query has been aborted as InfluxDB is not responding. Query timeout can be configured from the %{flask_icon} Preferences .", ["intranet_traffic"] = "%{net_1} -> %{net_2}", ["l7_proto"] = "Applications", @@ -3375,6 +3375,7 @@ local lang = { ["rem_host_anomalies"] = "Remote Hosts Anomalies", ["reset_zoom"] = "Reset Zoom", ["right_axis_note"] = "(right axis)", + ["rtt"] = "Round Trip Time", ["score"] = "Score", ["score_vs_hosts_flows"] = "Score vs Hosts/Flows", ["service_map_entries"] = "Service Map Entries", @@ -3442,6 +3443,8 @@ local lang = { ["as_cli"] = "As Client", ["as_srv"] = "As Server", ["bytes"] = "Bytes", + ["cli_score"] = "Client Score", + ["srv_score"] = "Server Score", ["contacts"] = "Contacts", ["devices"] = "Devices", ["drops"] = "Num. Drops", @@ -3460,6 +3463,7 @@ local lang = { ["queries"] = "Queries", ["queries_pkts"] = "Pkts. Queries", ["rcvd"] = "Rcvd", + ["rtt"] = "RTT", ["retran_pkts"] = "Retra. Pkts", ["score"] = "Score", ["sent"] = "Sent", diff --git a/scripts/lua/as_details.lua b/scripts/lua/as_details.lua index 981a6ff112..08aba936b3 100644 --- a/scripts/lua/as_details.lua +++ b/scripts/lua/as_details.lua @@ -138,43 +138,8 @@ if isEmptyString(page) or page == "historical" then print(" "..i18n("as_details.as_timeseries_enable_message",{url = ntop.getHttpPrefix().."/lua/admin/prefs.lua?tab=on_disk_ts",icon_flask=""})..'') else - local schema = _GET["ts_schema"] or default_schema - local selected_epoch = _GET["epoch"] or "" - local asn_url = ntop.getHttpPrefix()..'/lua/as_details.lua?ifid='..ifId..'&asn='..asn..'&page=historical' - - local tags = { - ifid = ifId, - asn = asn, - protocol = _GET["protocol"], - } - - local all_timeseries = { - {schema="asn:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]}, - {schema="asn:rtt", label=i18n("graphs.num_ms_rtt"), nedge_exclude=1}, - {schema="asn:traffic_sent", label=i18n("graphs.traffic_sent"), nedge_exclude=1}, - {schema="asn:traffic_rcvd", label=i18n("graphs.traffic_rcvd"), nedge_exclude=1}, - {schema="asn:score", label=i18n("score"), split_directions = true}, - {schema="asn:tcp_retransmissions", label=i18n("graphs.tcp_packets_retr"), nedge_exclude=1}, - {schema="asn:tcp_out_of_order", label=i18n("graphs.tcp_packets_ooo"), nedge_exclude=1}, - {schema="asn:tcp_lost", label=i18n("graphs.tcp_packets_lost"), nedge_exclude=1}, - {schema="asn:tcp_keep_alive", label=i18n("graphs.tcp_packets_keep_alive"), nedge_exclude=1}, - } - - if ntop.isPro() then - local pro_timeseries = { - {schema="asn:score_anomalies", label=i18n("graphs.iface_score_anomalies")}, - {schema="asn:score_behavior", label=i18n("graphs.iface_score_behavior"), split_directions = true, first_timeseries_only = true, metrics_labels = {i18n("graphs.score"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}}, - {schema="asn:traffic_anomalies", label=i18n("graphs.iface_traffic_anomalies")}, - {schema="asn:traffic_rx_behavior_v2", label=i18n("graphs.iface_traffic_rx_behavior"), split_directions = true, first_timeseries_only = true, time_elapsed = asn_behavior_update_freq, value_formatter = {"NtopUtils.fbits_from_bytes", "NtopUtils.bytesToSize"}, metrics_labels = {i18n("graphs.traffic_rcvd"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}}, - {schema="asn:traffic_tx_behavior_v2", label=i18n("graphs.iface_traffic_tx_behavior"), split_directions = true, first_timeseries_only = true, time_elapsed = asn_behavior_update_freq, value_formatter = {"NtopUtils.fbits_from_bytes", "NtopUtils.bytesToSize"}, metrics_labels = {i18n("graphs.traffic_sent"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}}, - } - all_timeseries = table.merge(all_timeseries, pro_timeseries) - end - - graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], asn_url, selected_epoch, { - top_protocols = "top:asn:ndpi", - timeseries = all_timeseries, - }) +-- top_protocols = "top:asn:ndpi" + graph_utils.drawNewGraphs(tonumber(asn), interface.getId()) end print[[ diff --git a/scripts/lua/country_details.lua b/scripts/lua/country_details.lua index 0d991e70b1..fe64850da8 100644 --- a/scripts/lua/country_details.lua +++ b/scripts/lua/country_details.lua @@ -57,21 +57,7 @@ local title = i18n("country_details.country") .. ": "..country Selectively render information pages --]] if page == "historical" then - local schema = _GET["ts_schema"] or "country:traffic" - local selected_epoch = _GET["epoch"] or "" - local url = ntop.getHttpPrefix()..'/lua/country_details.lua?ifid='..ifId..'&country='..country..'&page=historical' - - local tags = { - ifid = ifId, - country = country, - } - - graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, { - timeseries = { - {schema="country:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]}, - {schema="country:score", label=i18n("score"), split_directions = true}, - } - }) + graph_utils.drawNewGraphs(country, interface.getId()) end dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua") diff --git a/scripts/lua/modules/timeseries_info.lua b/scripts/lua/modules/timeseries_info.lua index 6c28f73e18..1770aaa137 100644 --- a/scripts/lua/modules/timeseries_info.lua +++ b/scripts/lua/modules/timeseries_info.lua @@ -91,6 +91,8 @@ local community_timeseries = { { schema = "iface:tcp_synack", label = i18n("graphs.tcp_synack_packets"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.packets'), timeseries = { packets = { label = i18n('graphs.tcp_syn_packets'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, { schema = "iface:tcp_finack", label = i18n("graphs.tcp_finack_packets"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.packets'), timeseries = { packets = { label = i18n('graphs.tcp_finack_packets'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, { schema = "iface:tcp_rst", label = i18n("graphs.tcp_rst_packets"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.packets'), timeseries = { packets = { label = i18n('graphs.tcp_rst_packets'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, + + -- host_details.lua (HOST): -- { schema = "host:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, { schema = "host:score", label = i18n("graphs.score"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.score'), timeseries = { cli_score = { label = i18n('graphs.cli_score'), color = timeseries_info.get_timeseries_color('cli_score') }, srv_score = { label = i18n('graphs.srv_score'), color = timeseries_info.get_timeseries_color('srv_score') }}}, { schema = "host:active_flows", label = i18n("graphs.active_flows"), priority = 0, measure_unit = "fps", scale = 0, timeseries = { flows_as_client = { label = i18n('graphs.flows_as_client'), color = timeseries_info.get_timeseries_color('flows') }, flows_as_server = { label = i18n('graphs.flows_as_server'), color = timeseries_info.get_timeseries_color('flows') }}}, @@ -114,18 +116,47 @@ local community_timeseries = { { schema = "host:udp_sent_unicast", label = i18n("graphs.udp_sent_unicast_vs_non_unicast"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent_unicast = { label = i18n('graphs.metric_labels.sent_uni'), color = timeseries_info.get_timeseries_color('bytes') }, bytes_sent_non_uni = { label = i18n('graphs.metric_labels.sent_non_uni'), color = timeseries_info.get_timeseries_color('bytes') }}}, { schema = "host:dscp", label = i18n("graphs.dscp_classes"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes') }, bytes_rcvd = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes') }}}, { schema = "host:host_tcp_unidirectional_flows", label = i18n("graphs.unidirectional_tcp_flows"), priority = 0, measure_unit = "fps",scale = 0, timeseries = { flows_as_client = { label = i18n('graphs.flows_as_client'), color = timeseries_info.get_timeseries_color('flows') }, flows_as_server = { label = i18n('graphs.flows_as_server'), color = timeseries_info.get_timeseries_color('flows') }}}, - { schema = "mac:traffic", label = i18n("traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, + + -- mac_details.lua (MAC): -- + { schema = "mac:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, -- network_details.lua (SUBNET): -- - { schema = "subnet:traffic", label = i18n("traffic"), measure_unit = "bps", scale = 0, timeseries = { bytes_egress = { label = i18n('graphs.metrics_suffixes.egress') }, bytes_ingress = { label = i18n('graphs.metrics_suffixes.ingress') }, bytes_inner = { label = i18n('graphs.metrics_suffixes.inner') }}, default_visible = true }, + { schema = "subnet:traffic", label = i18n("graphs.traffic"), measure_unit = "bps", scale = 0, timeseries = { bytes_egress = { label = i18n('graphs.metrics_suffixes.egress') }, bytes_ingress = { label = i18n('graphs.metrics_suffixes.ingress') }, bytes_inner = { label = i18n('graphs.metrics_suffixes.inner') }}, default_visible = true }, { schema = "subnet:broadcast_traffic", label = i18n("broadcast_traffic"), measure_unit = "bps", scale = 0, timeseries = { bytes_egress = { label = i18n('graphs.metrics_suffixes.egress') }, bytes_ingress = { label = i18n('graphs.metrics_suffixes.ingress') }, bytes_inner = { label = i18n('graphs.metrics_suffixes.inner') }} }, { schema = "subnet:engaged_alerts", label = i18n("show_alerts.engaged_alerts"), measure_unit = "number", scale = 0, timeseries = { alerts = { label = i18n('graphs.engaged_alerts') }} }, { schema = "subnet:score", label = i18n("score"), measure_unit = "number", scale = 0, timeseries = { score = { label = i18n('score') }, scoreAsClient = { label = i18n('score_as_client') }, scoreAsServer = { label = i18n('score_as_server') } }}, { schema = "subnet:tcp_retransmissions", label = i18n("graphs.tcp_packets_retr"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, - { schema = "subnet:tcp_out_of_order", label = i18n("graphs.tcp_packets_ooo"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, - { schema = "subnet:tcp_lost", label = i18n("graphs.tcp_packets_lost"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, - { schema = "subnet:tcp_keep_alive", label = i18n("graphs.tcp_packets_keep_alive"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, + { schema = "subnet:tcp_out_of_order", label = i18n("graphs.tcp_packets_ooo"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, + { schema = "subnet:tcp_lost", label = i18n("graphs.tcp_packets_lost"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, + { schema = "subnet:tcp_keep_alive", label = i18n("graphs.tcp_packets_keep_alive"), measure_unit = "number", scale = 0, timeseries = { packets_ingress = { label = i18n('if_stats_overview.ingress_packets') }, packets_egress = { label = i18n('if_stats_overview.egress_packets') }, packets_inner = { label = 'Inner Packets' } }}, + -- as_details.lua (ASN): -- + { schema = "asn:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, + { schema = "asn:rtt", label = i18n("graphs.rtt"), priority = 0, measure_unit = "ms", scale = 0, timeseries = { millis_rtt = { label = i18n('graphs.metric_labels.rtt'), color = timeseries_info.get_timeseries_color('default') } }, nedge_exclude = true }, + { schema = "asn:traffic_sent", label = i18n("graphs.traffic_sent"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') } }, nedge_exclude = true }, + { schema = "asn:traffic_rcvd", label = i18n("graphs.traffic_rcvd"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') } }, nedge_exclude = true }, + { schema = "asn:score", label = i18n("graphs.score"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.score'), timeseries = { score = { label = i18n('graphs.metric_labels.score'), color = timeseries_info.get_timeseries_color('score') }, cli_score = { label = i18n('graphs.metric_labels.cli_score'), color = timeseries_info.get_timeseries_color('cli_score') }, srv_score = { label = i18n('graphs.metric_labels.srv_score'), color = timeseries_info.get_timeseries_color('srv_score') } }}, + { schema = "asn:tcp_retransmissions", label = i18n("graphs.tcp_packets_retr"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.packets'), timeseries = { packets_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('packets') }, packets_rcvd = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, + { schema = "asn:tcp_keep_alive", label = i18n("graphs.tcp_packets_keep_alive"), priority = 0, measure_unit = "number", scale = i18n('graphs.metric_labels.packets'), timeseries = { packets_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('packets') }, packets_rcvd = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, + { schema = "asn:tcp_out_of_order", label = i18n("graphs.tcp_packets_ooo"), priority = 0, measure_unit = "number", scale = i18n('graphs.tcp_packets_ooo'), timeseries = { packets_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('packets') }, packets_rcvd = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, + { schema = "asn:tcp_lost", label = i18n("graphs.tcp_packets_lost"), priority = 0, measure_unit = "number", scale = i18n('graphs.tcp_packets_lost'), timeseries = { packets_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('packets') }, packets_rcvd = { label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('packets') }}, nedge_exclude = true }, + + -- country_details.lua (Country): -- + { schema = "country:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_egress = { label = i18n('graphs.metrics_suffixes.egress') }, bytes_ingress = { label = i18n('graphs.metrics_suffixes.ingress') }, bytes_inner = { label = i18n('graphs.metrics_suffixes.inner') }}, default_visible = true }, + { schema = "country:score", label = i18n("score"), priority = 0, measure_unit = "number", scale = 0, timeseries = { score = { label = i18n('score') }, scoreAsClient = { label = i18n('score_as_client') }, scoreAsServer = { label = i18n('score_as_server') } }}, + + -- os_details.lua (Operative System): -- + { schema = "os:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_egress = { label = i18n('graphs.metrics_suffixes.egress') }, bytes_ingress = { label = i18n('graphs.metrics_suffixes.ingress') }}, default_visible = true }, + + -- vlan_details.lua (VLAN): -- + { schema = "vlan:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, + { schema = "vlan:score", label = i18n("score"), priority = 0, measure_unit = "number", scale = 0, timeseries = { score = { label = i18n('score') }, scoreAsClient = { label = i18n('score_as_client') }, scoreAsServer = { label = i18n('score_as_server') } }}, + + -- pool_details.lua (Host Pool): -- + { schema = "host_pool:traffic", label = i18n("graphs.traffic"), priority = 0, measure_unit = "bps", scale = 0, timeseries = { bytes_sent = { label = i18n('graphs.metric_labels.sent'), color = timeseries_info.get_timeseries_color('bytes_sent') }, bytes_rcvd = { invert_direction = true, label = i18n('graphs.metric_labels.rcvd'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true }, + { schema = "host_pool:blocked_flows", label = i18n("graphs.blocked_flows"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_flows = { label = i18n('graphs.metric_labels.num_flows'), color = timeseries_info.get_timeseries_color('default') } } }, + { schema = "host_pool:hosts", label = i18n("graphs.active_hosts"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_hosts = { label = i18n('graphs.metric_labels.num_hosts'), color = timeseries_info.get_timeseries_color('default') } } }, + { schema = "host_pool:devices", label = i18n("graphs.active_devices"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_devices = { label = i18n('graphs.metric_labels.num_devices'), color = timeseries_info.get_timeseries_color('default') } } }, } -- ################################# @@ -253,22 +284,4 @@ end -- ################################# -function timeseries_info.get_interface_timeseries(tags) - return timeseries_info.retrieve_specific_timeseries(tags, 'iface') -end - --- ################################# - -function timeseries_info.get_host_timeseries(tags) - return timeseries_info.retrieve_specific_timeseries(tags, 'host') -end - --- ################################# - -function timeseries_info.get_mac_timeseries(tags) - return timeseries_info.retrieve_specific_timeseries(tags, 'mac') -end - --- ################################# - return timeseries_info diff --git a/scripts/lua/os_details.lua b/scripts/lua/os_details.lua index 6f213068cc..65a0a28084 100644 --- a/scripts/lua/os_details.lua +++ b/scripts/lua/os_details.lua @@ -40,7 +40,7 @@ end --[[ Create Menu Bar with buttons --]] -local nav_url = ntop.getHttpPrefix().."/lua/os_details.lua?country="..OS +local nav_url = ntop.getHttpPrefix().."/lua/os_details.lua?os="..OS local title = i18n("os_details.os") .. ": "..OS page_utils.print_navbar(title, nav_url, @@ -57,20 +57,7 @@ local title = i18n("os_details.os") .. ": "..OS Selectively render information pages --]] if page == "historical" then - local schema = _GET["ts_schema"] or "os:traffic" - local selected_epoch = _GET["epoch"] or "" - local url = ntop.getHttpPrefix()..'/lua/os_details.lua?ifid='..ifId..'&os='..OS..'&page=historical' - - local tags = { - ifid = ifId, - os = OS, - } - - graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, { - timeseries = { - {schema="os:traffic", label=i18n("traffic"), split_directions = true}, - } - }) + graph_utils.drawNewGraphs(tonumber(os), interface.getId()) end dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua") diff --git a/scripts/lua/pool_details.lua b/scripts/lua/pool_details.lua index 761b0ad474..a5ac0ea929 100644 --- a/scripts/lua/pool_details.lua +++ b/scripts/lua/pool_details.lua @@ -125,25 +125,8 @@ elseif page == "historical" then print("
"..i18n("pool_details.no_available_data_for_host_pool_message",{pool_name=pool_name})) print(" "..i18n("pool_details.host_pool_timeseries_enable_message",{url=ntop.getHttpPrefix().."/lua/admin/prefs.lua?tab=on_disk_ts",icon_flask=""})..'
') else - local schema = _GET["ts_schema"] or "host_pool:traffic" - local selected_epoch = _GET["epoch"] or "" - local url = getPageUrl(base_url, page_params) - - local tags = { - ifid = ifId, - pool = pool_id, - protocol = _GET["protocol"], - } - - graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, { - top_protocols = "top:host_pool:ndpi", - timeseries = { - {schema="host_pool:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]}, - {schema="host_pool:blocked_flows", label=i18n("graphs.blocked_flows")}, - {schema="host_pool:hosts", label=i18n("graphs.active_hosts")}, - {schema="host_pool:devices", label=i18n("graphs.active_devices")}, - }, - }) + --top_protocols = "top:host_pool:ndpi", + graph_utils.drawNewGraphs(tonumber(pool_id), interface.getId()) end end diff --git a/scripts/lua/vlan_details.lua b/scripts/lua/vlan_details.lua index 844bcbd923..5d7baab4c8 100644 --- a/scripts/lua/vlan_details.lua +++ b/scripts/lua/vlan_details.lua @@ -81,14 +81,8 @@ else vlan = vlan_id, protocol = _GET["protocol"], } - - graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], vlan_url, selected_epoch, { - top_protocols = "top:vlan:ndpi", - timeseries = { - {schema="vlan:traffic", label=i18n("traffic")}, - {schema="vlan:score", label=i18n("score"), split_directions = true}, - }, - }) + -- top_protocols = "top:vlan:ndpi", + graph_utils.drawNewGraphs(tonumber(vlan_id), interface.getId()) elseif (page == "config") then if(not isAdministrator()) then return