Added exporter/probe data refresh

This commit is contained in:
Matteo Biscosi 2024-07-19 20:07:33 +02:00
parent 6212d3c262
commit f45e6d8c73
7 changed files with 129 additions and 17 deletions

View file

@ -932,9 +932,9 @@ function getExporterInfo(unique_source_id) -- Exporter unique_source_id
local found = false
if ifstats.probes then
for interface_id, probe_list in pairs(ifstats.probes or {}) do
for probe_id, probe_info in pairsByValues(probe_list or {}, asc) do
for probe_id, probe_info in pairs(probe_list or {}) do
if probe_info.exporters and table.len(probe_info.exporters) > 0 then -- Sflow or NetFlow/IPFIX
for exporter_ip, exporter_info in pairsByValues(probe_info.exporters or {}, asc) do
for exporter_ip, exporter_info in pairs(probe_info.exporters or {}) do
if exporter_info.unique_source_id == unique_source_id then
return {
exporter_ip = exporter_ip,
@ -956,3 +956,23 @@ function getExporterInfo(unique_source_id) -- Exporter unique_source_id
return exporter
end
-- ##############################################
function getProbeFromUUID(nprobe_uuid)
nprobe_uuid = tonumber(nprobe_uuid)
local ifstats = interface.getStats()
local exporter = {}
local found = false
if ifstats.probes then
for interface_id, probe_list in pairs(ifstats.probes or {}) do
for probe_id, probe_info in pairs(probe_list or {}) do
if nprobe_uuid == probe_info["probe.uuid_num"] then
return probe_info
end
end
end
end
return nil
end