mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
render new timeseries page in ntopng community and > pro for mac, interface and host
This commit is contained in:
parent
52ee37ae72
commit
2bcbcf52b1
3 changed files with 125 additions and 123 deletions
|
|
@ -2316,94 +2316,94 @@ elseif (page == "config") then
|
|||
</script>]]
|
||||
|
||||
elseif(page == "historical") then
|
||||
graph_utils.drawNewGraphs()
|
||||
-- host_url = "host="..host_ip
|
||||
-- host_key = host_ip
|
||||
-- if(host_vlan and (host_vlan > 0)) then
|
||||
-- host_url = host_url.."&vlan="..host_vlan
|
||||
-- host_key = host_key.."@"..host_vlan
|
||||
-- end
|
||||
|
||||
host_url = "host="..host_ip
|
||||
host_key = host_ip
|
||||
if(host_vlan and (host_vlan > 0)) then
|
||||
host_url = host_url.."&vlan="..host_vlan
|
||||
host_key = host_key.."@"..host_vlan
|
||||
end
|
||||
-- local schema = _GET["ts_schema"] or "host:traffic"
|
||||
-- local selected_epoch = _GET["epoch"] or ""
|
||||
|
||||
local schema = _GET["ts_schema"] or "host:traffic"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
-- local tags = {
|
||||
-- ifid = ifId,
|
||||
-- host = host_key,
|
||||
-- protocol = _GET["protocol"],
|
||||
-- category = _GET["category"],
|
||||
-- l4proto = _GET["l4proto"],
|
||||
-- dscp_class = _GET["dscp_class"],
|
||||
-- }
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
host = host_key,
|
||||
protocol = _GET["protocol"],
|
||||
category = _GET["category"],
|
||||
l4proto = _GET["l4proto"],
|
||||
dscp_class = _GET["dscp_class"],
|
||||
}
|
||||
-- local items = split(_GET["ts_query"], ",") or {}
|
||||
|
||||
local items = split(_GET["ts_query"], ",") or {}
|
||||
-- for _, concat_tag in pairs(items) do
|
||||
-- local tag = split(concat_tag, ":")
|
||||
|
||||
for _, concat_tag in pairs(items) do
|
||||
local tag = split(concat_tag, ":")
|
||||
-- if (tag) and (tag[1] == "dscp_class") then
|
||||
-- tags["dscp_class"] = tag[2]
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
|
||||
if (tag) and (tag[1] == "dscp_class") then
|
||||
tags["dscp_class"] = tag[2]
|
||||
break
|
||||
end
|
||||
end
|
||||
-- local url = hostinfo2detailsurl(host, {page = "historical"})
|
||||
-- local show_graph = true
|
||||
|
||||
local url = hostinfo2detailsurl(host, {page = "historical"})
|
||||
local show_graph = true
|
||||
-- if not host["localhost"] or
|
||||
-- (host["localhost"] == false or
|
||||
-- host["is_multicast"] == true) then
|
||||
-- show_graph = false
|
||||
-- end
|
||||
|
||||
if not host["localhost"] or
|
||||
(host["localhost"] == false or
|
||||
host["is_multicast"] == true) then
|
||||
show_graph = false
|
||||
end
|
||||
-- local timeseries = table.merge({
|
||||
-- {schema="host:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]},
|
||||
-- {schema="host:score", label=i18n("score"), metrics_labels = { i18n("graphs.cli_score"), i18n("graphs.srv_score")}},
|
||||
-- {schema="host:active_flows", label=i18n("graphs.active_flows")},
|
||||
-- {schema="host:total_flows", label=i18n("db_explorer.total_flows")},
|
||||
-- {schema="host:num_blacklisted_flows", label=i18n("graphs.num_blacklisted_flows")},
|
||||
-- {schema="host:alerted_flows", label=i18n("graphs.total_alerted_flows")},
|
||||
-- {schema="host:unreachable_flows", label=i18n("graphs.total_unreachable_flows")},
|
||||
-- {schema="host:contacts", label=i18n("graphs.active_host_contacts")},
|
||||
-- {schema="host:total_alerts", label=i18n("details.alerts")},
|
||||
-- {schema="host:engaged_alerts", label=i18n("show_alerts.engaged_alerts")},
|
||||
-- {schema="host:host_unreachable_flows", label=i18n("graphs.host_unreachable_flows")},
|
||||
-- {schema="host:dns_qry_sent_rsp_rcvd", label=i18n("graphs.dns_qry_sent_rsp_rcvd")},
|
||||
-- {schema="host:dns_qry_rcvd_rsp_sent", label=i18n("graphs.dns_qry_rcvd_rsp_sent")},
|
||||
-- {schema="host:udp_pkts", label=i18n("graphs.udp_packets")},
|
||||
-- {schema="host:tcp_rx_stats", label=i18n("graphs.tcp_rx_stats")},
|
||||
-- {schema="host:tcp_tx_stats", label=i18n("graphs.tcp_tx_stats")},
|
||||
-- {schema="host:echo_reply_packets", label=i18n("graphs.echo_reply_packets")},
|
||||
-- {schema="host:echo_packets", label=i18n("graphs.echo_request_packets")},
|
||||
-- {schema="host:tcp_packets", label=i18n("graphs.tcp_packets")},
|
||||
-- {schema="host:udp_sent_unicast", label=i18n("graphs.udp_sent_unicast_vs_non_unicast")},
|
||||
-- {schema="host:dscp", label=i18n("graphs.dscp_classes")},
|
||||
-- }, graph_utils.getDeviceCommonTimeseries())
|
||||
|
||||
local timeseries = table.merge({
|
||||
{schema="host:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]},
|
||||
{schema="host:score", label=i18n("score"), metrics_labels = { i18n("graphs.cli_score"), i18n("graphs.srv_score")}},
|
||||
{schema="host:active_flows", label=i18n("graphs.active_flows")},
|
||||
{schema="host:total_flows", label=i18n("db_explorer.total_flows")},
|
||||
{schema="host:num_blacklisted_flows", label=i18n("graphs.num_blacklisted_flows")},
|
||||
{schema="host:alerted_flows", label=i18n("graphs.total_alerted_flows")},
|
||||
{schema="host:unreachable_flows", label=i18n("graphs.total_unreachable_flows")},
|
||||
{schema="host:contacts", label=i18n("graphs.active_host_contacts")},
|
||||
{schema="host:total_alerts", label=i18n("details.alerts")},
|
||||
{schema="host:engaged_alerts", label=i18n("show_alerts.engaged_alerts")},
|
||||
{schema="host:host_unreachable_flows", label=i18n("graphs.host_unreachable_flows")},
|
||||
{schema="host:dns_qry_sent_rsp_rcvd", label=i18n("graphs.dns_qry_sent_rsp_rcvd")},
|
||||
{schema="host:dns_qry_rcvd_rsp_sent", label=i18n("graphs.dns_qry_rcvd_rsp_sent")},
|
||||
{schema="host:udp_pkts", label=i18n("graphs.udp_packets")},
|
||||
{schema="host:tcp_rx_stats", label=i18n("graphs.tcp_rx_stats")},
|
||||
{schema="host:tcp_tx_stats", label=i18n("graphs.tcp_tx_stats")},
|
||||
{schema="host:echo_reply_packets", label=i18n("graphs.echo_reply_packets")},
|
||||
{schema="host:echo_packets", label=i18n("graphs.echo_request_packets")},
|
||||
{schema="host:tcp_packets", label=i18n("graphs.tcp_packets")},
|
||||
{schema="host:udp_sent_unicast", label=i18n("graphs.udp_sent_unicast_vs_non_unicast")},
|
||||
{schema="host:dscp", label=i18n("graphs.dscp_classes")},
|
||||
}, graph_utils.getDeviceCommonTimeseries())
|
||||
-- if(ntop.isPro()) then
|
||||
-- timeseries = table.merge(timeseries, {
|
||||
-- {schema="host:contacts_behaviour", label=i18n("graphs.host_contacts_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.contacts"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
-- {schema="host:srv_score_behaviour", label=i18n("graphs.srv_score_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.score"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
-- {schema="host:cli_score_behaviour", label=i18n("graphs.cli_score_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.score"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
-- {schema="host:srv_active_flows_behaviour", label=i18n("graphs.srv_active_flows_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.active_flows"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
-- {schema="host:cli_active_flows_behaviour", label=i18n("graphs.cli_active_flows_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.active_flows"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
-- {schema="host:srv_score_anomalies", label=i18n("graphs.srv_score_anomalies")},
|
||||
-- {schema="host:cli_score_anomalies", label=i18n("graphs.cli_score_anomalies")},
|
||||
-- {schema="host:srv_active_flows_anomalies", label=i18n("graphs.srv_active_flows_anomalies")},
|
||||
-- {schema="host:cli_active_flows_anomalies", label=i18n("graphs.cli_active_flows_anomalies")},
|
||||
-- })
|
||||
-- end
|
||||
|
||||
if(ntop.isPro()) then
|
||||
timeseries = table.merge(timeseries, {
|
||||
{schema="host:contacts_behaviour", label=i18n("graphs.host_contacts_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.contacts"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
{schema="host:srv_score_behaviour", label=i18n("graphs.srv_score_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.score"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
{schema="host:cli_score_behaviour", label=i18n("graphs.cli_score_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.score"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
{schema="host:srv_active_flows_behaviour", label=i18n("graphs.srv_active_flows_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.active_flows"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
{schema="host:cli_active_flows_behaviour", label=i18n("graphs.cli_active_flows_behaviour"), split_directions = true, metrics_labels = {i18n("graphs.active_flows"), i18n("graphs.lower_bound"), i18n("graphs.upper_bound")}},
|
||||
{schema="host:srv_score_anomalies", label=i18n("graphs.srv_score_anomalies")},
|
||||
{schema="host:cli_score_anomalies", label=i18n("graphs.cli_score_anomalies")},
|
||||
{schema="host:srv_active_flows_anomalies", label=i18n("graphs.srv_active_flows_anomalies")},
|
||||
{schema="host:cli_active_flows_anomalies", label=i18n("graphs.cli_active_flows_anomalies")},
|
||||
})
|
||||
end
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
top_protocols = "top:host:ndpi",
|
||||
top_categories = "top:host:ndpi_categories",
|
||||
l4_protocols = "host:l4protos",
|
||||
dscp_classes = "iface:dscp",
|
||||
show_historical = true,
|
||||
tskey = tskey,
|
||||
timeseries = timeseries,
|
||||
device_timeseries_mac = host["mac"],
|
||||
}, show_graph, true)
|
||||
-- graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
-- top_protocols = "top:host:ndpi",
|
||||
-- top_categories = "top:host:ndpi_categories",
|
||||
-- l4_protocols = "host:l4protos",
|
||||
-- dscp_classes = "iface:dscp",
|
||||
-- show_historical = true,
|
||||
-- tskey = tskey,
|
||||
-- timeseries = timeseries,
|
||||
-- device_timeseries_mac = host["mac"],
|
||||
-- }, show_graph, true)
|
||||
|
||||
elseif(page == "traffic_report") then
|
||||
package.path = dirs.installdir .. "/pro/scripts/lua/enterprise/?.lua;" .. package.path
|
||||
|
|
|
|||
|
|
@ -1478,38 +1478,39 @@ elseif(page == "sites") then
|
|||
end
|
||||
|
||||
elseif(page == "historical") then
|
||||
local schema = _GET["ts_schema"]
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local tags = {
|
||||
ifid = ifid,
|
||||
protocol = _GET["protocol"],
|
||||
category = _GET["category"],
|
||||
l4proto = _GET["l4proto"],
|
||||
dscp_class = _GET["dscp_class"],
|
||||
}
|
||||
url = url.."&page=historical"
|
||||
graph_utils.drawNewGraphs()
|
||||
-- local schema = _GET["ts_schema"]
|
||||
-- local selected_epoch = _GET["epoch"] or ""
|
||||
-- local tags = {
|
||||
-- ifid = ifid,
|
||||
-- protocol = _GET["protocol"],
|
||||
-- category = _GET["category"],
|
||||
-- l4proto = _GET["l4proto"],
|
||||
-- dscp_class = _GET["dscp_class"],
|
||||
-- }
|
||||
-- url = url.."&page=historical"
|
||||
|
||||
if(schema == nil) then
|
||||
if(ifstats.has_traffic_directions) then
|
||||
schema = "iface:traffic_rxtx"
|
||||
else
|
||||
schema = "iface:traffic"
|
||||
end
|
||||
end
|
||||
-- if(schema == nil) then
|
||||
-- if(ifstats.has_traffic_directions) then
|
||||
-- schema = "iface:traffic_rxtx"
|
||||
-- else
|
||||
-- schema = "iface:traffic"
|
||||
-- end
|
||||
-- end
|
||||
|
||||
local top_enabled = top_talkers_utils.areTopEnabled(ifid)
|
||||
-- local top_enabled = top_talkers_utils.areTopEnabled(ifid)
|
||||
|
||||
graph_utils.drawGraphs(ifstats.id, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
top_protocols = "top:iface:ndpi",
|
||||
top_categories = "top:iface:ndpi_categories",
|
||||
top_profiles = "top:profile:traffic",
|
||||
top_senders = ternary(top_enabled, "top:local_senders", nil),
|
||||
top_receivers = ternary(top_enabled, "top:local_receivers", nil),
|
||||
l4_protocols = "iface:l4protos",
|
||||
dscp_classes = "iface:dscp",
|
||||
show_historical = not ifstats.isViewed,
|
||||
timeseries = graph_utils.get_default_timeseries()
|
||||
}, nil, true)
|
||||
-- graph_utils.drawGraphs(ifstats.id, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
-- top_protocols = "top:iface:ndpi",
|
||||
-- top_categories = "top:iface:ndpi_categories",
|
||||
-- top_profiles = "top:profile:traffic",
|
||||
-- top_senders = ternary(top_enabled, "top:local_senders", nil),
|
||||
-- top_receivers = ternary(top_enabled, "top:local_receivers", nil),
|
||||
-- l4_protocols = "iface:l4protos",
|
||||
-- dscp_classes = "iface:dscp",
|
||||
-- show_historical = not ifstats.isViewed,
|
||||
-- timeseries = graph_utils.get_default_timeseries()
|
||||
-- }, nil, true)
|
||||
elseif(page == "trafficprofiles") then
|
||||
|
||||
print("<table class=\"table table-striped table-bordered\">\n")
|
||||
|
|
|
|||
|
|
@ -395,22 +395,23 @@ elseif(page == "snmp" and has_snmp_location) then
|
|||
snmp_location.print_host_snmp_localization_table_entry(mac)
|
||||
print[[</table>]]
|
||||
elseif(page == "historical") then
|
||||
local schema = _GET["ts_schema"] or "mac:traffic"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
url = url..'&page=historical'
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
mac = mac,
|
||||
category = _GET["category"],
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
top_categories = "top:mac:ndpi_categories",
|
||||
timeseries = table.merge({
|
||||
{schema="mac:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]},
|
||||
}, graph_utils.getDeviceCommonTimeseries())
|
||||
})
|
||||
graph_utils.drawNewGraphs()
|
||||
-- local schema = _GET["ts_schema"] or "mac:traffic"
|
||||
-- local selected_epoch = _GET["epoch"] or ""
|
||||
-- tprint(hostinfo2hostkey(host_info))
|
||||
-- url = url..'&page=historical&mac='..hostinfo2hostkey(host_info)
|
||||
-- --..hostinfo2url(host_info, nil, nil, "mac")
|
||||
-- local tags = {
|
||||
-- ifid = ifId,
|
||||
-- mac = mac,
|
||||
-- category = _GET["category"],
|
||||
-- }
|
||||
-- graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
-- top_categories = "top:mac:ndpi_categories",
|
||||
-- timeseries = table.merge({
|
||||
-- {schema="mac:traffic", label=i18n("traffic"), split_directions = true --[[ split RX and TX directions ]]},
|
||||
-- }, graph_utils.getDeviceCommonTimeseries())
|
||||
-- })
|
||||
|
||||
elseif(page == "config") then
|
||||
if(not isAdministrator()) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue