mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
imporvement on active monitoring table columns
When a infrastructure host is inside the table a small icon (a building) will appear to indicate a infrastructure.
This commit is contained in:
parent
dcf5144c04
commit
7f9f44809b
3 changed files with 19 additions and 12 deletions
|
|
@ -413,6 +413,10 @@ $(document).ready(function() {
|
|||
return (row.label);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'measurement',
|
||||
width: '5%'
|
||||
},
|
||||
{
|
||||
data: 'chart',
|
||||
class: 'text-center',
|
||||
|
|
|
|||
|
|
@ -279,18 +279,19 @@ end
|
|||
-- @brief Check if this is an infrastructure active monitoring url
|
||||
local function is_infrastructure(host)
|
||||
if not ntop.isEnterpriseM() or isEmptyString(host) then
|
||||
return false
|
||||
return false, nil
|
||||
end
|
||||
|
||||
package.path = dirs.installdir .. "/pro/scripts/lua/enterprise/modules/?.lua;" .. package.path
|
||||
local infrastructure_utils = require("infrastructure_utils")
|
||||
|
||||
-- The host is considered an infrastructure host if it contains the endpoint in the name
|
||||
if host:find(infrastructure_utils.ENDPOINT_TO_EXTRACT_DATA) then
|
||||
return true
|
||||
if host:find(infrastructure_utils.ENDPOINT_TO_EXTRACT_DATA) or host:find(infrastructure_utils.SUFFIX_THROUGHPUT) then
|
||||
local instance = infrastructure_utils.get_instance_by_host(host)
|
||||
return true, instance.alias
|
||||
end
|
||||
|
||||
return false
|
||||
return false, nil
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
@ -310,19 +311,20 @@ function am_utils.formatAmHost(host, measurement, isHtml)
|
|||
end
|
||||
|
||||
local res = host
|
||||
|
||||
if not host:starts(measurement) then
|
||||
res = string.format("%s://%s", measurement, host)
|
||||
end
|
||||
local is_infr, infr_name = is_infrastructure(host)
|
||||
|
||||
-- Make a smarter way to determine infrastructure labels
|
||||
if is_infrastructure(host) then
|
||||
if is_infr then
|
||||
|
||||
-- Make a nicer label for infrastructure hosts
|
||||
-- If the am host contains a name for the infrastructure use it
|
||||
if isHtml then
|
||||
res = res:gsub("/lua/.+", " <span class='badge badge-info'>".. i18n("infrastructure_dashboard.infrastructure") .."</span>")
|
||||
res = infr_name .. " <i class='fas fa-building'></i>"
|
||||
else
|
||||
res = res:gsub("/lua/.+", " [".. i18n("infrastructure_dashboard.infrastructure") .. "]")
|
||||
res = infr_name .. " [".. i18n("infrastructure_dashboard.infrastructure") .. "]"
|
||||
end
|
||||
else
|
||||
res = host
|
||||
end
|
||||
|
||||
return res
|
||||
|
|
@ -471,7 +473,7 @@ function am_utils.addHost(host, measurement, am_value, granularity, pool, token,
|
|||
granularity = granularity or "min",
|
||||
token = token, -- ntopng auth token
|
||||
save_result = save_result, -- save the result
|
||||
readonly = readonly
|
||||
readonly = readonly,
|
||||
}))
|
||||
|
||||
-- Bind the host from any existing pool
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>{{i18n("flow_details.url")}}</th>
|
||||
<th>{{i18n("active_monitoring_stats.measurement")}}</th>
|
||||
<th>{{i18n("chart")}}</th>
|
||||
<th>{{i18n("threshold")}}</th>
|
||||
<th>{{i18n("active_monitoring.24h")}}</th>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue