Various fixes to ASN Traffic Rules (#9555)

* Various fixes to ASN Traffic Rules

* Formatted ASN names for ASN traffic rules alerts
This commit is contained in:
Manuel Ceroni 2025-08-25 14:51:46 +02:00 committed by GitHub
parent 5b06353a9d
commit 33ad9fc7b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View file

@ -1,5 +1,5 @@
--
-- (C) 2019-24 - ntop.org
-- (C) 2019-25 - ntop.org
--
-- ##############################################
@ -61,7 +61,9 @@ function alert_asn_rule_threshold_crossed.format(ifid, alert, alert_type_params)
alert_type_params.frequency = i18n("edit_check.hooks_name.day")
end
if(alert_type_params.metric == "asn:traffic") then
if(alert_type_params.metric == "asn:traffic" or
alert_type_params.metric == "asn:traffic_rcvd" or
alert_type_params.metric == "asn:traffic_sent") then
if(alert_type_params.metric_type == "volume") then
alert_type_params.value = bytesToSize(alert_type_params.value)
alert_type_params.threshold = bytesToSize(alert_type_params.threshold)
@ -78,10 +80,11 @@ function alert_asn_rule_threshold_crossed.format(ifid, alert, alert_type_params)
alert_type_params.threshold = string.format("%s",tostring(alert_type_params.threshold)).. "%"
end
end
return(i18n("alert_messages.traffic_asn_volume_alert", {
url = "/lua/as_overview.lua?asn=",
url = "/lua/as_overview.lua?asn="..alert_type_params.asn,
asn = alert_type_params.asn,
asn_name = format_utils.formatASN(tonumber(alert_type_params.asn), true, false),
metric = alert_type_params.metric,
value = alert_type_params.value,
threshold_sign = alert_type_params.threshold_sign,