mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Changed name value and fixed self nil value
This commit is contained in:
parent
fa87ab4cc4
commit
a616a8f06f
2 changed files with 12 additions and 4 deletions
|
|
@ -114,7 +114,7 @@ end
|
|||
-- ##############################################
|
||||
|
||||
--@brief Merge top clients and top servers to build a top hosts
|
||||
local function top_ip_merge(top_cli_ip, top_srv_ip)
|
||||
function flow_alert_store:top_ip_merge(top_cli_ip, top_srv_ip)
|
||||
local all_ip = {}
|
||||
local top_ip = {}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ function flow_alert_store:_get_additional_stats()
|
|||
stats.top = {}
|
||||
stats.top.cli_ip = self:top_cli_ip_historical()
|
||||
stats.top.srv_ip = self:top_srv_ip_historical()
|
||||
stats.top.ip = top_ip_merge(stats.top.cli_ip, stats.top.srv_ip)
|
||||
stats.top.ip = self:top_ip_merge(stats.top.cli_ip, stats.top.srv_ip)
|
||||
return stats
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -37,21 +37,29 @@ interface.select(ifid)
|
|||
|
||||
local res = flow_alert_store:get_stats()
|
||||
local top_alerts = {}
|
||||
local top_hosts = {}
|
||||
|
||||
for _, value in pairs(res.top.alert_id) do
|
||||
top_alerts[#top_alerts + 1] = {
|
||||
count = value.count,
|
||||
alert_name = alert_consts.alertTypeLabel(tonumber(value.alert_id), true),
|
||||
name = alert_consts.alertTypeLabel(tonumber(value.alert_id), true),
|
||||
}
|
||||
end
|
||||
|
||||
for _, value in pairs(res.top.ip) do
|
||||
top_hosts[#top_hosts + 1] = {
|
||||
count = value.count,
|
||||
name = value.ip,
|
||||
}
|
||||
end
|
||||
|
||||
-- Request from the frontend - to have them as array
|
||||
res = {
|
||||
{
|
||||
label = i18n("alerts_dashboard.top_hosts"),
|
||||
tooltip = i18n("alerts_dashboard.tooltips.top_hosts"),
|
||||
value = {
|
||||
res.top.ip
|
||||
top_hosts
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue