Replace calls to getResolvedAddress with host2name

This commit is contained in:
emanuele-f 2020-03-31 11:52:50 +02:00
parent 4b1184acdb
commit 02c36d4140
17 changed files with 73 additions and 45 deletions

View file

@ -126,14 +126,16 @@ if stats_type == "top_talkers" then
-- CASE 01: compute interface-wide top-talkers for the selected time interval
res = getOverallTopTalkers(ifid, l4_proto_id, port, vlan, profile, nil, epoch_start, epoch_end, sort_column, sort_order, offset, limit)
for _, record in pairs(res) do
record["label"] = getResolvedAddress(hostkey2hostinfo(record["addr"]))
local hinfo = hostkey2hostinfo(record["addr"])
record["label"] = host2name(hinfo["host"], hinfo["vlan"])
end
elseif not peer1 and not peer2 and l7_proto_id and l7_proto_id ~= "" then
-- CASE 02: compute top-talkers for the specified L7 protocol
res = getAppTopTalkers(ifid, l7_proto_id, l4_proto_id, port, vlan, profile, nil, epoch_start, epoch_end, sort_column, sort_order, offset, limit)
for _, record in pairs(res) do
record["label"] = getResolvedAddress(hostkey2hostinfo(record["addr"]))
local hinfo = hostkey2hostinfo(record["addr"])
record["label"] = host2name(hinfo["host"], hinfo["vlan"])
end
elseif peer1 and peer1 ~="" then
-- CASE 03: compute top-talkers with the given peer1
@ -142,7 +144,8 @@ if stats_type == "top_talkers" then
res = getHostTopTalkers(ifid, peer1, l7_proto_id, l4_proto_id, port, vlan, profile, nil, epoch_start, epoch_end, sort_column, sort_order, offset, limit)
for _, record in pairs(res) do
record["label"] = getResolvedAddress(hostkey2hostinfo(record["addr"]))
local hinfo = hostkey2hostinfo(record["addr"])
record["label"] = host2name(hinfo["host"], hinfo["vlan"])
end
-- tprint(res)
end