Implemented lua caching to speedump hostname and interface mapping lookup

This commit is contained in:
Luca Deri 2025-10-23 22:28:53 +02:00
parent 8d13fe3411
commit e0e4e8ea96
11 changed files with 817 additions and 600 deletions

View file

@ -13,6 +13,7 @@ pragma_once_lua_utils_get = true
require "ntop_utils"
require "label_utils"
require "check_redis_prefs"
local cache_utils = require "cache_utils"
local clock_start = os.clock()
local snmp_cached_devices = {}
@ -97,11 +98,19 @@ function getProbeName(exporter_ip, show_vlan, shorten_len, show_ip_and_alias)
if show_ip_and_alias == nil then
show_ip_and_alias = true
end
if tonumber(exporter_ip) then
exporter_ip = ntop.inet_ntoa(exporter_ip)
end
if(exporter_ip ~= nil) then
local ret = cache_utils.gethostname(exporter_ip)
if(not isEmptyString(ret)) then
return(ret)
end
end
local cached_device_name
local snmp_cached_dev
local probe_alias = probes_names[exporter_ip]