Reworks TCP issues flow user script

This commit is contained in:
Simone Mainardi 2020-10-30 15:56:36 +01:00
parent 965198e928
commit 389f9c2beb
15 changed files with 273 additions and 127 deletions

View file

@ -259,4 +259,64 @@ function format_utils.formatContainerFromId(cont_id)
end
end
-- @brief Formatter function for two flow statuses. Places here to ease reuse.
-- Current flow statuses sharing this function are status_tcp_severe_connection_issues
-- and status_tcp_connection_issues
function format_utils.formatConnectionIssues(info)
local res = i18n("flow_details.tcp_connection_issues")
if info.client_issues and info.tcp_stats and info.cli2srv_pkts then
local retx = info.tcp_stats["cli2srv.retransmissions"]
local ooo = info.tcp_stats["cli2srv.out_of_order"]
local lost = info.tcp_stats["cli2srv.lost"]
local what = {}
if retx > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_retx", {retx = format_utils.formatValue(retx)})
end
if ooo > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_ooo", {ooo = format_utils.formatValue(ooo)})
end
if lost > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_lost", {lost = format_utils.formatValue(lost)})
end
if info.cli2srv_pkts > 0 then
what[#what + 1] = i18n("alerts_dashboard.out_of_x_total_packets", {tot = format_utils.formatValue(info.cli2srv_pkts)})
end
if #what > 0 then
res = res.." "..string.format("[%s: %s]", i18n("client_to_server"), table.concat(what, ", "))
end
end
if info.server_issues and info.tcp_stats and info.srv2cli_pkts then
local retx = info.tcp_stats["srv2cli.retransmissions"]
local ooo = info.tcp_stats["srv2cli.out_of_order"]
local lost = info.tcp_stats["srv2cli.lost"]
local what = {}
if retx > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_retx", {retx = format_utils.formatValue(retx)})
end
if ooo > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_ooo", {ooo = format_utils.formatValue(ooo)})
end
if lost > 0 then
what[#what + 1] = i18n("alerts_dashboard.x_lost", {lost = format_utils.formatValue(lost)})
end
if info.srv2cli_pkts > 0 then
what[#what + 1] = i18n("alerts_dashboard.out_of_x_total_packets", {tot = format_utils.formatValue(info.srv2cli_pkts)})
end
if #what > 0 then
res = res.." "..string.format("[%s: %s]", i18n("server_to_client"), table.concat(what, ", "))
end
end
return res
end
return format_utils