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

@ -2,8 +2,7 @@
-- (C) 2019-22 - ntop.org
--
local alert_entities = require("alert_entities")
local alert_utils = require("alert_utils")
local alert_consts = require("alert_consts")
local checks = require("checks")
local script = {
@ -12,6 +11,8 @@ local script = {
default_enabled = true,
severity = alert_consts.get_printable_severities().warning,
-- The default configuration of this script
default_value = {
items = {},
@ -46,4 +47,4 @@ end
-- #################################################################
return script
return script

View file

@ -11,7 +11,7 @@ local script = {
category = checks.check_categories.network,
default_enabled = false,
severity = alert_consts.get_printable_severities().error,
default_value = {
operator = "gt",

View file

@ -11,7 +11,7 @@ local script = {
category = checks.check_categories.security,
default_enabled = false,
severity = alert_consts.get_printable_severities().error,
default_value = {
operator = "gt",

View file

@ -9,6 +9,7 @@ local checks = require("checks")
local script = {
-- Script category
category = checks.check_categories.network,
severity = alert_consts.get_printable_severities().error,
default_enabled = false,

View file

@ -11,7 +11,7 @@ local script = {
category = checks.check_categories.network,
default_enabled = false,
severity = alert_consts.get_printable_severities().error,
default_value = {
operator = "gt",

View file

@ -5,6 +5,7 @@ local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local checks = require("checks")
local alert_consts = require "alert_consts"
-- #################################################################
@ -19,6 +20,7 @@ end
local script = {
-- Script category
category = checks.check_categories.network,
severity = alert_consts.get_printable_severities().warning,
-- Off by default
default_enabled = false,

View file

@ -6,7 +6,19 @@ 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.network,
severity = alert_consts.get_printable_severities().notice,
default_enabled = true,
hooks = {},
gui = {
i18n_title = "checks.network_discovery_title",
i18n_description = "checks.network_discovery_description",
}
}
-- #################################################################
@ -14,10 +26,8 @@ local function check_network_discovery(params)
-- Get total number of packets, flows and interface id
local network_discovery_check = alert_consts.alert_types.alert_network_discovery_executed.new()
network_discovery_check:set_score_notice()
network_discovery_check:set_subtype(getInterfaceName(interface.getId()))
network_discovery_check:set_granularity(params.granularity)
network_discovery_check:set_subtype(params)
local discovery_executed = ntop.getCache("ntopng.cache.network_discovery_executed.ifid_" .. interface.getId()) == "1"
if discovery_executed == true then
@ -28,21 +38,7 @@ end
-- #################################################################
script = {
-- Script category
category = checks.check_categories.network,
default_enabled = true,
hooks = {
-- Time past between one call and an other
min = check_network_discovery,
},
gui = {
i18n_title = "checks.network_discovery_title",
i18n_description = "checks.network_discovery_description",
}
}
script.hooks.min = check_network_discovery
-- #################################################################

View file

@ -11,6 +11,7 @@ local script = {
-- Script category
category = checks.check_categories.security,
severity = alert_consts.get_printable_severities().error,
default_enabled = false,

View file

@ -11,6 +11,7 @@ local script = {
-- Script category
category = checks.check_categories.security,
severity = alert_consts.get_printable_severities().error,
-- This module is disabled by default
default_enabled = false,