Fixes #5169 nil label on alerts

This commit is contained in:
Matteo Biscosi 2021-04-13 10:45:04 +02:00
parent 70a6d1e0e6
commit 9d2bd43bd8
2 changed files with 6 additions and 4 deletions

View file

@ -23,7 +23,7 @@ local host_alert_score = classes.class(alert)
host_alert_score.meta = {
alert_key = host_alert_keys.host_alert_score,
i18n_title = "alerts_dashboard.threashold_cross",
i18n_title = "alerts_dashboard.score_threshold_cross",
icon = "fas fa-arrow-circle-up",
}
@ -54,9 +54,9 @@ function host_alert_score.format(ifid, alert, alert_type_params)
local entity = alert_consts.formatAlertEntity(ifid, alert_consts.alertEntityRaw(alert["alert_entity"]), alert["alert_entity_val"])
local engine_label = alert_consts.alertEngineLabel(alert_consts.alertEngine(alert_consts.sec2granularity(alert["alert_granularity"])))
return i18n("alert_messages.threshold_crossed", {
granularity = engine_label,
metric = alert_type_params.metric,
tprint(alert)
tprint(alert_consts.alertEngineLabel(alert_consts.alertEngine(alert_consts.sec2granularity(alert["alert_granularity"]))))
return i18n("alert_messages.host_alert_score", {
entity = entity,
host_category = format_utils.formatAddressCategory((json.decode(alert.alert_json)).alert_generation.host_info),
value = string.format("%u", math.ceil(alert_type_params.value)),