mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Added severity to ntopng checks table
This commit is contained in:
parent
933e8339ec
commit
eda4cfb088
48 changed files with 406 additions and 340 deletions
|
|
@ -10,6 +10,7 @@ local script = {
|
|||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
severity = alert_consts.get_printable_severities().error,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
|
@ -33,9 +34,8 @@ local function dropped_alerts_check(params)
|
|||
delta_drops
|
||||
)
|
||||
|
||||
alert:set_score_error()
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(getInterfaceName(interface.getId()))
|
||||
alert:set_granularity(params.granularity)
|
||||
|
||||
if(delta_drops > 0) then
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,21 @@
|
|||
local alerts_api = require("alerts_api")
|
||||
local alert_consts = require("alert_consts")
|
||||
local checks = require("checks")
|
||||
local script
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.security,
|
||||
|
||||
default_enabled = true,
|
||||
|
||||
severity = alert_consts.get_printable_severities().warning,
|
||||
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.ghost_networks",
|
||||
i18n_description = "alerts_dashboard.ghost_networks_description",
|
||||
},
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -17,8 +31,7 @@ local function check_ghost_networks(params)
|
|||
|
||||
local alert = alert_consts.alert_types.alert_ghost_network.new(domain)
|
||||
|
||||
alert:set_score_warning()
|
||||
alert:set_granularity(params.granularity)
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(domain)
|
||||
|
||||
if(delta_hits > 0) then
|
||||
|
|
@ -32,22 +45,7 @@ end
|
|||
|
||||
-- #################################################################
|
||||
|
||||
script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.security,
|
||||
|
||||
default_enabled = true,
|
||||
|
||||
|
||||
hooks = {
|
||||
min = check_ghost_networks,
|
||||
},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.ghost_networks",
|
||||
i18n_description = "alerts_dashboard.ghost_networks_description",
|
||||
},
|
||||
}
|
||||
script.hooks.min = check_ghost_networks
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,20 @@ local alerts_api = require("alerts_api")
|
|||
local alert_consts = require "alert_consts"
|
||||
local checks = require("checks")
|
||||
|
||||
local script
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
default_enabled = true,
|
||||
hooks = {},
|
||||
|
||||
severity = alert_consts.get_printable_severities().critical,
|
||||
|
||||
gui = {
|
||||
i18n_title = "checks.no_if_activity_title",
|
||||
i18n_description = "checks.no_if_activity_description",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -21,20 +34,12 @@ local function check_interface_activity(params)
|
|||
|
||||
local no_if_activity_type = alert_consts.alert_types.alert_no_if_activity.new(params.entity_info.name)
|
||||
|
||||
no_if_activity_type:set_score_critical()
|
||||
no_if_activity_type:set_subtype(params.entity_info.name)
|
||||
no_if_activity_type:set_granularity(params.granularity)
|
||||
no_if_activity_type:set_info(params)
|
||||
|
||||
local delta_packets = alerts_api.interface_delta_val(params.check.key..".pkts" --[[ metric name --]], params.granularity, num_packets or 0)
|
||||
local delta_flows = alerts_api.interface_delta_val(params.check.key..".flows" --[[ metric name --]], params.granularity, num_flows or 0)
|
||||
local delta_logs = alerts_api.interface_delta_val(params.check.key..".logs" --[[ metric name --]], params.granularity, num_logs or 0)
|
||||
|
||||
-- tprint(">>> selected: "..interface.getId() .. " name: "..getInterfaceName(interface.getId()))
|
||||
-- tprint(params.alert_entity)
|
||||
-- tprint("delta_packets: "..delta_packets.. " delta_flows: "..delta_flows.. " delta_logs: "..delta_logs)
|
||||
-- tprint("num_packets: "..num_packets.. " num_flows: "..num_flows.. " num_logs: "..num_logs)
|
||||
-- tprint("<<<")
|
||||
|
||||
-- Check if the previous number it's equal to the actual number of both, packets and flows
|
||||
-- this distinction is done due to the fact that exist packet based interfaces
|
||||
-- and flow based interfaces
|
||||
|
|
@ -47,23 +52,7 @@ end
|
|||
|
||||
-- #################################################################
|
||||
|
||||
script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
default_enabled = true,
|
||||
hooks = {
|
||||
-- Time past between one call and an other
|
||||
--["5mins"] = check_interface_activity,
|
||||
min = check_interface_activity,
|
||||
},
|
||||
|
||||
|
||||
gui = {
|
||||
i18n_title = "checks.no_if_activity_title",
|
||||
i18n_description = "checks.no_if_activity_description",
|
||||
}
|
||||
}
|
||||
script.hooks.min = check_interface_activity
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -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().warning,
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.periodic_activity_not_executed",
|
||||
i18n_description = "alerts_dashboard.periodic_activity_not_executed_descr",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -21,8 +32,7 @@ local function check_periodic_activity_not_executed(params)
|
|||
ps_stats["last_queued_time"] or 0
|
||||
)
|
||||
|
||||
alert:set_score_warning()
|
||||
alert:set_granularity(params.granularity)
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(ps_name)
|
||||
|
||||
if delta > 0 then
|
||||
|
|
@ -37,20 +47,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
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,19 @@ 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",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
@ -21,8 +33,7 @@ local function check_slow_periodic_activity(params)
|
|||
(ps_stats["max_duration_secs"] or 0) * 1000
|
||||
)
|
||||
|
||||
alert:set_score_error()
|
||||
alert:set_granularity(params.granularity)
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(ps_name)
|
||||
|
||||
if delta > 0 then
|
||||
|
|
@ -37,20 +48,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
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,32 @@ local alerts_api = require("alerts_api")
|
|||
local alert_consts = require("alert_consts")
|
||||
local checks = require("checks")
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
default_enabled = true,
|
||||
default_value = {
|
||||
-- "> 50%"
|
||||
operator = "gt",
|
||||
threshold = 50,
|
||||
},
|
||||
|
||||
severity = alert_consts.get_printable_severities().error,
|
||||
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.alert_slow_purge_threshold",
|
||||
i18n_description = "alerts_thresholds_config.alert_slow_purge_threshold_descr",
|
||||
i18n_field_unit = checks.field_units.percentage,
|
||||
input_builder = "threshold_cross",
|
||||
field_max = 99,
|
||||
field_min = 1,
|
||||
field_operator = "gt";
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
local function check_interface_idle(params)
|
||||
|
|
@ -33,9 +59,8 @@ local function check_interface_idle(params)
|
|||
threshold
|
||||
)
|
||||
|
||||
alert:set_score_error()
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(getInterfaceName(interface.getId()))
|
||||
alert:set_granularity(params.granularity)
|
||||
|
||||
if max_idle_perc > threshold then
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
|
|
@ -46,32 +71,7 @@ end
|
|||
|
||||
-- #################################################################
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
default_enabled = true,
|
||||
default_value = {
|
||||
-- "> 50%"
|
||||
operator = "gt",
|
||||
threshold = 50,
|
||||
},
|
||||
|
||||
|
||||
hooks = {
|
||||
min = check_interface_idle,
|
||||
},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.alert_slow_purge_threshold",
|
||||
i18n_description = "alerts_thresholds_config.alert_slow_purge_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_idle
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ local script = {
|
|||
threshold = 80,
|
||||
},
|
||||
|
||||
severity = alert_consts.get_printable_severities().error,
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
|
|
@ -54,9 +55,7 @@ function script.hooks.min(params)
|
|||
threshold
|
||||
)
|
||||
|
||||
alert:set_score_error()
|
||||
alert:set_subtype(params.entity_info["name"])
|
||||
alert:set_granularity(params.granularity)
|
||||
alert:set_info(params)
|
||||
|
||||
if(value > threshold) then
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
-- #################################################################
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue