diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index 37bd7ed81f..264a15f168 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -506,6 +506,8 @@ local lang = { ["ntopng_update"] = "Started after software update", ["open_files_limit_too_small"] = "Ntopng detected that the maximum number of files MySQL can open is potentially too small. This can result in flow data loss due to errors such as [Out of resources when opening file './ntopng/flowsv6#P#p22.MYD' (Errcode: 24 - Too many open files)][23]. Make sure to increase open_files_limit or, if you just want to ignore this warning, disable the check from the preferences.", ["periodic_activity_not_executed"] = "Periodic activity \"%{script}\" is queued but has not been executed. No thread available for execution. [Pending since %{pending_since}]", + ["periodicity_update_new"] = "Flow %{host_info1} %{host_info2} [Application: %{l7_proto}] %{info} is now periodic (freq. %{frequency} sec)", + ["periodicity_update_ended"] = "Periodic flow ended: %{host_info1} %{host_info2} [Application: %{l7_proto}] %{info}", ["ping_host_unreachable_v3"] = "Host %{host} %{numeric_ip} is unreachable.", ["potentially_dangerous_protocol_description"] = "This flow can be harmful for the network because an outdated or vulnerable protocol is in use.", ["proto_bytes_quotas"] = "%{proto} bytes", diff --git a/scripts/lua/modules/alert_definitions/alert_periodicity_update.lua b/scripts/lua/modules/alert_definitions/alert_periodicity_update.lua index d2d4128d44..dd820a2f6d 100644 --- a/scripts/lua/modules/alert_definitions/alert_periodicity_update.lua +++ b/scripts/lua/modules/alert_definitions/alert_periodicity_update.lua @@ -55,31 +55,25 @@ function alert_periodicity_update.format(ifid, alert, alert_type_params) local rsp if alert_type_params.created_or_removed == "create" then - rsp = "Flow " - rsp = rsp .. hostinfo2detailshref(client, nil, hostinfo2label(client)).. - " " .. - hostinfo2detailshref(server, nil, hostinfo2label(server)).. - " ["..i18n("port")..": "..msg.dport.."]" + rsp = { + host_info1 = hostinfo2detailshref(client, nil, hostinfo2label(client)), + host_info2 = hostinfo2detailshref(server, nil, hostinfo2label(server)), + l7_proto = interface.getnDPIProtoName(msg.l7), + info = shortenString(msg.info, 24) or "", + frequency = msg.frequency or "", + } - rsp = rsp .. "["..i18n("application")..": "..interface.getnDPIProtoName(msg.l7).."]" - if not isEmptyString(msg.info) then - rsp = rsp .. "[" .. msg.info .. "]" - end - rsp = rsp .. " is now periodic (freq. " .. msg["frequency"] .. " sec)" + return (i18n("alert_messages.periodicity_update_new", rsp)) else - rsp = "Periodic flow ended: " - rsp = rsp .. hostinfo2detailshref(client, nil, hostinfo2label(client)).. - " " .. - hostinfo2detailshref(server, nil, hostinfo2label(server)).. - " ["..i18n("port")..": "..msg.dport.."]" - - rsp = rsp .. "["..i18n("application")..": "..interface.getnDPIProtoName(msg.l7).."]" - if not isEmptyString(msg.info) then - rsp = rsp .. "[" .. shortenString(msg.info, 24) .. "]" - end + rsp = { + host_info1 = hostinfo2detailshref(client, nil, hostinfo2label(client)), + host_info2 = hostinfo2detailshref(server, nil, hostinfo2label(server)), + l7_proto = interface.getnDPIProtoName(msg.l7), + info = shortenString(msg.info, 24) or "", + } + + return (i18n("alert_messages.periodicity_update_ended", rsp)) end - - return(rsp) end -- #######################################################