mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 19:15:03 +00:00
Added mac location in macs page
This commit is contained in:
parent
7f2ee53660
commit
ac09e43818
6 changed files with 167 additions and 3 deletions
|
|
@ -60,4 +60,36 @@ if table.len(device_types) > 1 then
|
|||
}
|
||||
end
|
||||
|
||||
if ntop.isnEdge() then
|
||||
local location_list = {
|
||||
{
|
||||
key = "location",
|
||||
value = "all",
|
||||
label = i18n('hosts_stats.all')
|
||||
},
|
||||
{
|
||||
key = "location",
|
||||
value = "wan",
|
||||
label = i18n('nedge.wan')
|
||||
},
|
||||
{
|
||||
key = "location",
|
||||
value = "lan",
|
||||
label = i18n('nedge.lan')
|
||||
},
|
||||
{
|
||||
key = "location",
|
||||
value = "unknown",
|
||||
label = i18n('nedge.unknown')
|
||||
}
|
||||
}
|
||||
|
||||
rsp[#rsp + 1] = {
|
||||
action = "location",
|
||||
label = i18n("hosts_stats.location"),
|
||||
name = "location",
|
||||
value = location_list
|
||||
}
|
||||
end
|
||||
|
||||
rest_utils.answer(rest_utils.consts.success.ok, rsp)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ local all = _GET["all"]
|
|||
local sort_order = _GET["order"]
|
||||
local devices_mode = _GET["devices_mode"]
|
||||
local manufacturer = _GET["manufacturer"]
|
||||
local location = _GET["location"] or ""
|
||||
local device_type = tonumber(_GET["device_type"])
|
||||
|
||||
function macHosts(mac)
|
||||
|
|
@ -60,7 +61,7 @@ end
|
|||
if manufacturer == "" then manufacturer = nil end
|
||||
if device_type == "" then device_type = nil end
|
||||
local macs_stats = interface.getMacsInfo(false, nil, 0, c_order,
|
||||
source_macs_only, manufacturer, nil, device_type, "", nil)
|
||||
source_macs_only, manufacturer, nil, device_type, location, nil)
|
||||
local total_rows = #macs_stats["macs"]
|
||||
|
||||
local record = {}
|
||||
|
|
@ -70,11 +71,14 @@ if macs_stats.macs then
|
|||
for key, value in pairs(macs_stats["macs"]) do
|
||||
record = {}
|
||||
record["mac"] = value["mac"]
|
||||
|
||||
|
||||
local manufacturer = value["manufacturer"]
|
||||
if (manufacturer == nil) then
|
||||
manufacturer = ""
|
||||
end
|
||||
if ntop.isnEdge() then
|
||||
record["location"] = value.location
|
||||
end
|
||||
if (value["model"] ~= nil) then
|
||||
local _model = discover.apple_products[value["model"]] or value["model"]
|
||||
manufacturer = manufacturer .. " [ " .. shortenString(_model) .. " ]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue