Added severity to ntopng checks table

This commit is contained in:
MatteoBiscosi 2022-10-20 10:34:23 +02:00
parent 933e8339ec
commit eda4cfb088
48 changed files with 406 additions and 340 deletions

View file

@ -6,7 +6,32 @@ local alerts_api = require("alerts_api")
local checks = require("checks")
local alert_consts = require("alert_consts")
local script
-- #################################################################
local script = {
-- Script category
category = checks.check_categories.system,
default_enabled = true,
default_value = {
-- "> 5%"
operator = "gt",
threshold = 5,
},
severity = alert_consts.get_printable_severities().error,
hooks = {},
gui = {
i18n_title = "show_alerts.interface_drops_threshold",
i18n_description = "show_alerts.interface_drops_threshold_descr",
i18n_field_unit = checks.field_units.percentage,
input_builder = "threshold_cross",
field_max = 99,
field_min = 1,
field_operator = "gt";
}
}
-- #################################################################
@ -22,9 +47,8 @@ local function check_interface_drops(params)
threshold
)
alert:set_score_error()
alert:set_info(params)
alert:set_subtype(getInterfaceName(interface.getId()))
alert:set_granularity(params.granularity)
if((stats.packets > 100) and (drop_perc > threshold)) then
alert:trigger(params.alert_entity, nil, params.cur_alerts)
@ -35,32 +59,7 @@ end
-- #################################################################
script = {
-- Script category
category = checks.check_categories.system,
default_enabled = true,
default_value = {
-- "> 5%"
operator = "gt",
threshold = 5,
},
hooks = {
min = check_interface_drops,
},
gui = {
i18n_title = "show_alerts.interface_drops_threshold",
i18n_description = "show_alerts.interface_drops_threshold_descr",
i18n_field_unit = checks.field_units.percentage,
input_builder = "threshold_cross",
field_max = 99,
field_min = 1,
field_operator = "gt";
}
}
script.hooks.min = check_interface_drops
-- #################################################################