mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
* Fix vlan historical filter. (#6714) * Update enabling "check live" link. (#6714) * Fix vlan_id set and remove hardcoded string. (#6714) * Add comments. (#6714) * Update historical chart filters. (#6714)
This commit is contained in:
parent
e0b5b11351
commit
c3fa801d37
2 changed files with 21 additions and 6 deletions
|
|
@ -52,14 +52,23 @@ function host_alert_score_threshold.format(ifid, alert, alert_type_params)
|
|||
local threshold = alert_type_params["threshold"] or 0
|
||||
local as_cli_or_srv = i18n("client")
|
||||
local as_cli = true
|
||||
local vlan_id = tonumber(alert["vlan_id"] or 0)
|
||||
|
||||
-- Checks if alerted host is a client or a server.
|
||||
if alert_type_params["is_client_alert"] == false then
|
||||
as_cli_or_srv = i18n("server")
|
||||
as_cli = false
|
||||
end
|
||||
|
||||
local flows_info_href = ""
|
||||
|
||||
-- Checks if host is still in memory, in case add link to live flows on the alert description.
|
||||
interface.select(ifid)
|
||||
if interface.getHostInfo(alert["ip"],vlan_id) then
|
||||
flows_info_href = '[ '..i18n("check_live")..': <a href="' .. ntop.getHttpPrefix().."/lua/flows_stats.lua?host="..host..'" data-placement="bottom" title="Live Flow Explorer"><i class="fas fa-search-plus"></i></a> ] '
|
||||
end
|
||||
|
||||
local flows_info_href = '(check live: <a href="' .. ntop.getHttpPrefix().."/lua/flows_stats.lua?host="..host..'" data-placement="bottom" title="Live Flow Explorer"><i class="fas fa-search-plus"></i></a>)'
|
||||
|
||||
-- Checks if ClickHouse is enabled, in case add link to historical flows on the alert description.
|
||||
if ntop.isClickHouseEnabled() then
|
||||
|
||||
local extra_params = {
|
||||
|
|
@ -68,15 +77,19 @@ function host_alert_score_threshold.format(ifid, alert, alert_type_params)
|
|||
operator = "eq"
|
||||
},
|
||||
epoch_begin = {
|
||||
value = alert.tstamp,
|
||||
value = tonumber(alert.tstamp) - 600,
|
||||
operator = "eq"
|
||||
},
|
||||
epoch_end = {
|
||||
value = alert.tstamp_end,
|
||||
value = tonumber(alert.tstamp_end) + 600,
|
||||
operator = "eq"
|
||||
},
|
||||
score = {
|
||||
value = 0,
|
||||
operator = "gt"
|
||||
}
|
||||
}
|
||||
if alert["vlan_id"] ~= 0 then
|
||||
if vlan_id > 0 then
|
||||
extra_params.vlan_id = {
|
||||
value = alert["vlan_id"],
|
||||
operator = "eq"
|
||||
|
|
@ -95,7 +108,7 @@ function host_alert_score_threshold.format(ifid, alert, alert_type_params)
|
|||
}
|
||||
end
|
||||
|
||||
flows_info_href = flows_info_href..' (check historical: <a href="' .. add_historical_flow_explorer_button_ref(extra_params,true) ..'" data-placement="bottom" title="Historical Flow Explorer"><i class="fas fa-search-plus"></i></a>)'
|
||||
flows_info_href = flows_info_href..'[ '..i18n("check_historical")..': <a href="' .. add_historical_flow_explorer_button_ref(extra_params,true) ..'" data-placement="bottom" title="Historical Flow Explorer"><i class="fas fa-search-plus"></i></a> ]'
|
||||
end
|
||||
|
||||
if (tonumber(alert_type_params["value"]) > tonumber(threshold)) and (threshold > 0) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue