mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Rework host threshold alerts definition
This commit is contained in:
parent
328c8a7084
commit
b16136f5b4
13 changed files with 125 additions and 124 deletions
|
|
@ -8,24 +8,20 @@ local alert_consts = require("alert_consts")
|
|||
local check_module = {
|
||||
key = "packets",
|
||||
alert_type = alert_consts.alert_types.threshold_cross,
|
||||
check_function = alerts_api.threshold_check_function,
|
||||
|
||||
gui = {
|
||||
title = "packets",
|
||||
subtitle = "alerts_thresholds_config.alert_packets_description",
|
||||
field = {field_unit = alert_consts.field_units.packets},
|
||||
i18n_title = "packets",
|
||||
i18n_description = "alerts_thresholds_config.alert_packets_description",
|
||||
i18n_field_unit = alert_consts.field_units.packets,
|
||||
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(check_module.key, granularity, info["packets.sent"] + info["packets.rcvd"])
|
||||
|
||||
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["packets.sent"] + info["packets.rcvd"])
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue