mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Implements and rework alert for flow periodicity change
This commit is contained in:
parent
41df57253e
commit
f6560d1974
6 changed files with 58 additions and 16 deletions
|
|
@ -26,16 +26,12 @@ alert_periodicity_changed.meta = {
|
|||
-- ##############################################
|
||||
|
||||
-- @brief Prepare an alert table used to generate the alert
|
||||
-- @param last_error A table containing the last lateral movement error, e.g.,
|
||||
-- {"event":"create","shost":"192.168.2.153","dhost":"224.0.0.68","dport":1968,"vlan_id":0,"l4":17,"l7":0,"first_seen":1602488355,"last_seen":1602488355,"num_uses":1}
|
||||
-- @return A table with the alert built
|
||||
function alert_periodicity_changed:init(last_error, created_or_removed)
|
||||
function alert_periodicity_changed:init()
|
||||
-- Call the parent constructor
|
||||
self.super:init()
|
||||
|
||||
self.alert_type_params = {
|
||||
error_msg = last_error,
|
||||
created_or_removed = created_or_removed
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -49,7 +45,7 @@ end
|
|||
function alert_periodicity_changed.format(ifid, alert, alert_type_params)
|
||||
-- Extracting info field
|
||||
local info = ""
|
||||
local href = ""
|
||||
local href = '<a href="/lua/pro/enterprise/periodicity_map.lua"><i class="fas fa-lg fa-clock"></i></a>'
|
||||
|
||||
if alert.json then
|
||||
info = json.decode(alert["json"])
|
||||
|
|
@ -60,9 +56,13 @@ function alert_periodicity_changed.format(ifid, alert, alert_type_params)
|
|||
end
|
||||
end
|
||||
|
||||
href = '<a href="/lua/pro/enterprise/periodicity_map.lua"><i class="fas fa-lg fa-clock"></i></a>'
|
||||
|
||||
return(i18n("alerts_dashboard.periodicity_changed_descr", { info = info, href = href }))
|
||||
if alert_type_params.is_periodic then
|
||||
return(i18n("alerts_dashboard.periodicity_is_periodic_descr", { info = info, href = href }))
|
||||
elseif alert_type_params.is_aperiodic then
|
||||
return(i18n("alerts_dashboard.periodicity_is_aperiodic_descr", { info = info, href = href }))
|
||||
else
|
||||
return(i18n("alerts_dashboard.periodicity_changed_descr", { info = info, href = href }))
|
||||
end
|
||||
end
|
||||
|
||||
-- #######################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue