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

@ -9,7 +9,7 @@ local alert_consts = require("alert_consts")
local script = {
-- Script category
category = checks.check_categories.internals,
severity = alert_consts.get_printable_severities().error,
-- See below
hooks = {},
@ -39,9 +39,8 @@ local function dropped_alerts_check(params)
delta_drops
)
alert:set_score_error()
alert:set_granularity(params.granularity)
alert:set_info(params)
if(delta_drops > 0) then
alert:trigger(params.alert_entity, nil, params.cur_alerts)
else

View file

@ -9,7 +9,20 @@ 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.ids_ips,
severity = alert_consts.get_printable_severities().notice,
default_enabled = false,
hooks = {},
gui = {
i18n_title = "show_alerts.ids_ips_log",
i18n_description = "show_alerts.ids_ips_log_descr",
}
}
-- #################################################################
@ -32,9 +45,8 @@ local function check_ids_ips_log(params)
os.time()
)
alert:set_score_notice()
alert:set_info(params)
alert:set_subtype(added_host)
alert:set_granularity(params.granularity)
alert:store(params.alert_entity, nil, params.cur_alerts)
@ -67,21 +79,7 @@ end
-- #################################################################
script = {
-- Script category
category = checks.check_categories.ids_ips,
default_enabled = false,
hooks = {
min = check_ids_ips_log,
},
gui = {
i18n_title = "show_alerts.ids_ips_log",
i18n_description = "show_alerts.ids_ips_log_descr",
}
}
script.hooks.min = check_ids_ips_log
-- #################################################################

View file

@ -6,7 +6,18 @@ local alert_consts = require("alert_consts")
local alerts_api = require("alerts_api")
local checks = require("checks")
local script
local script = {
-- Script category
category = checks.check_categories.internals,
severity = alert_consts.get_printable_severities().error,
hooks = {},
gui = {
i18n_title = "alerts_dashboard.periodic_activity_not_executed",
i18n_description = "alerts_dashboard.periodic_activity_not_executed_descr",
}
}
-- #################################################################
@ -20,9 +31,9 @@ local function check_periodic_activity_not_executed(params)
ps_stats["last_queued_time"] or 0
)
alert:set_score_error()
alert:set_granularity(params.granularity)
alert:set_info(params)
alert:set_subtype(ps_name)
if delta > 0 then
-- tprint({ps_name = ps_name, s = ">>>>>>>>>>>>>>>>>>>>>> TRIGGER"})
alert:trigger(params.alert_entity, nil, params.cur_alerts)
@ -35,20 +46,7 @@ end
-- #################################################################
script = {
-- Script category
category = checks.check_categories.internals,
hooks = {
min = check_periodic_activity_not_executed,
},
gui = {
i18n_title = "alerts_dashboard.periodic_activity_not_executed",
i18n_description = "alerts_dashboard.periodic_activity_not_executed_descr",
}
}
script.hooks.min = check_periodic_activity_not_executed
-- #################################################################

View file

@ -6,9 +6,18 @@ local alert_consts = require("alert_consts")
local alerts_api = require("alerts_api")
local checks = require("checks")
local script
local script = {
-- Script category
category = checks.check_categories.internals,
severity = alert_consts.get_printable_severities().error,
-- ##############################################
hooks = {},
gui = {
i18n_title = "alerts_dashboard.slow_periodic_activity",
i18n_description = "alerts_dashboard.slow_periodic_activity_descr",
}
}
-- #################################################################
@ -23,8 +32,7 @@ local function check_slow_periodic_activity(params)
ps_stats["max_duration_secs"] * 1000
)
alert:set_score_error()
alert:set_granularity(params.granularity)
alert:set_info(params)
alert:set_subtype(ps_name)
if delta > 0 then
@ -39,20 +47,7 @@ end
-- #################################################################
script = {
-- Script category
category = checks.check_categories.internals,
hooks = {
min = check_slow_periodic_activity,
},
gui = {
i18n_title = "alerts_dashboard.slow_periodic_activity",
i18n_description = "alerts_dashboard.slow_periodic_activity_descr",
}
}
script.hooks.min = check_slow_periodic_activity
-- #################################################################