Rework host threshold alerts definition

This commit is contained in:
emanuele-f 2019-07-11 18:15:57 +02:00
parent 328c8a7084
commit b16136f5b4
13 changed files with 125 additions and 124 deletions

View file

@ -8,24 +8,20 @@ local alert_consts = require("alert_consts")
local check_module = {
key = "throughput",
alert_type = alert_consts.alert_types.threshold_cross,
check_function = alerts_api.threshold_check_function,
gui = {
title = "alerts_thresholds_config.throughput",
subtitle = "alerts_thresholds_config.alert_throughput_description",
field = {field_unit = alert_consts.field_units.mbits},
i18n_title = "alerts_thresholds_config.throughput",
i18n_description = "alerts_thresholds_config.alert_throughput_description",
i18n_field_unit = alert_consts.field_units.mbits,
input_builder = alerts_api.threshold_cross_input_builder,
}
}
-- #################################################################
function check_module.check_function(granularity, host_key, info, threshold_config)
local current_value = alerts_api.host_delta_val(metric_name, granularity, info["bytes.sent"] + info["bytes.rcvd"]) * 8 / granularity2sec(granularity)
return(alerts_api.check_threshold_cross(
granularity, check_module.key,
alerts_api.hostAlertEntity(host_key),
current_value, threshold_config
))
function check_module.get_threshold_value(granularity, info)
return alerts_api.host_delta_val(check_module.key, granularity, info["bytes.sent"] + info["bytes.rcvd"]) * 8 / granularity2sec(granularity)
end
-- #################################################################