mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
scripts: add listing for Communities
This commit adds code both to the Lua bindings and scripts to allow to list Communities and hosts belonging to the communities. This allows to list hosts of just a community and get the related info in real time.
This commit is contained in:
parent
3230294c37
commit
5a76f4bdd4
11 changed files with 322 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ network = _GET["network"]
|
|||
country = _GET["country"]
|
||||
os_ = _GET["os"]
|
||||
antenna_mac = _GET["antenna_mac"]
|
||||
community = _GET["community"]
|
||||
|
||||
-- table_id = _GET["table"]
|
||||
|
||||
|
|
@ -287,9 +288,25 @@ num = 0
|
|||
for _key, _value in pairsByKeys(vals, funct) do
|
||||
key = vals[_key]
|
||||
|
||||
community_found = false
|
||||
if (community ~= nil) then
|
||||
communities = interface.getHostCommunities(hosts_stats[key]["ip"], hosts_stats[key]["vlan"])
|
||||
if (communities) then
|
||||
for ck,cv in pairs(communities) do
|
||||
if (tostring(cv) == community) then
|
||||
community_found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
community_found = true
|
||||
end
|
||||
|
||||
if((key ~= nil) and (not(key == "")) and
|
||||
((asn == nil) or (asn == tostring(hosts_stats[key]["asn"]))) and
|
||||
((os_ == nil) or (os_ == tostring(hosts_stats[key]["os"]))) and
|
||||
(community_found == true) and
|
||||
((country == nil) or (country == tostring(hosts_stats[key]["country"]))) and
|
||||
((antenna_mac == nil) or (antenna_mac == tostring(hosts_stats[key]["antenna_mac"]))) and
|
||||
((vlan == nil) or (vlan == tostring(hosts_stats[key]["vlan"]))) and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue