Added links to the ASN Sankey (#9343)

* Added links to the ASN Sankey

* Fixed the ASN sankey links and added a link for the exporter_details
This commit is contained in:
Manuel Ceroni 2025-07-04 14:22:53 +02:00 committed by GitHub
parent 87bfc6cd5a
commit f51d615771
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 6 deletions

View file

@ -90,9 +90,10 @@ local links = {}
local node_set = {}
local as_root_key = "root";
local max_len = 32
local ifstats = interface.getStats()
table.insert(nodes, {
link = "/",
link = ntop.getHttpPrefix() .. "/lua/hosts_stats.lua?asn=" .. asn .. "",
node_id = as_root_key,
label = format_utils.formatASN(asn)
})
@ -108,6 +109,18 @@ end
local function reset_nodes() node_set = {} end
local function search_probe(ip)
for interface_id, probe_list in pairs(ifstats.probes or {}) do
for probe_ip, probe_info in pairsByKeys(probe_list or {}) do
for exporter_ip, exporter_info in pairsByKeys(probe_info.exporters or {}) do
if exporter_ip==ip then
return {probe_uuid = probe_info["probe.uuid_num"], exporter_uuid = exporter_info["unique_source_id"]}
end
end
end
end
end
-- ####################
-- Total bytes sent/rcvd per exporter (key = <device ip>)
@ -181,8 +194,22 @@ local function build_interface_exporter(criteria, tot_bytes_exp_if,
if (exporter_nodes[data.exporter_ip] == nil) then
exporter_nodes[data.exporter_ip] = exporter_node_id
end
add_unique_node(exporter_node_id, exporter_ip, "#")
add_unique_node(port_node_id, port_index, "#")
nprobe_stats = search_probe(data.exporter_ip)
local url = "#"
if ntop.isEnterprise() then
url = ntop.getHttpPrefix() ..
'/lua/pro/enterprise/exporter_details.lua?ip=' .. exporter_ip ..
'&exporter_uuid=' .. nprobe_stats.exporter_uuid ..
'&probe_uuid=' .. nprobe_stats.probe_uuid
end
add_unique_node(exporter_node_id, exporter_ip, url)
url = "#"
if ntop.isEnterprise() then
url = ntop.getHttpPrefix() ..
'/lua/pro/enterprise/snmp_interface_details.lua?host='.. data.exporter_ip ..
'&snmp_port_idx='.. data.port_index
end
add_unique_node(port_node_id, port_index, url)
if criteria == traffic_criteria.INGRESS then
-- Interface -> Exporter