mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Add last RTT, IP and update time for RTT monitored hosts
This commit is contained in:
parent
8a7487d868
commit
976de25de6
5 changed files with 86 additions and 6 deletions
|
|
@ -10,12 +10,44 @@ local rtt_hosts_key = "ntopng.prefs.system_rtt_hosts"
|
|||
|
||||
-- ##############################################
|
||||
|
||||
local function rtt_last_updates_key(key)
|
||||
return("ntopng.cache.system_rtt_hosts.last_update." .. key)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function rtt_utils.host2key(host, iptype, probetype)
|
||||
return table.concat({host, iptype, probetype}, "@")
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function rtt_utils.setLastRttUpdate(key, when, rtt, ipaddress)
|
||||
ntop.setCache(rtt_last_updates_key(key), string.format("%u@%.2f@%s", when, rtt, ipaddress))
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function rtt_utils.getLastRttUpdate(key)
|
||||
local val = ntop.getCache(rtt_last_updates_key(key))
|
||||
|
||||
if(val ~= nil)then
|
||||
local parts = string.split(val, "@")
|
||||
|
||||
if((parts ~= nil) and (#parts == 3)) then
|
||||
return {
|
||||
when = parts[1],
|
||||
value = parts[2],
|
||||
ip = parts[3],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return(nil)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function rtt_utils.key2label(key)
|
||||
local parts = string.split(key, "@")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue