mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Removed no more used checks (#8235)
This commit is contained in:
parent
1640d1b036
commit
88e5d26afe
8 changed files with 1 additions and 4 deletions
|
|
@ -1,78 +0,0 @@
|
|||
--
|
||||
-- (C) 2019-24 - ntop.org
|
||||
--
|
||||
|
||||
require "ntop_utils"
|
||||
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)
|
||||
local threshold = tonumber(params.check_config.threshold)
|
||||
local engage = false
|
||||
local max_idle = 0
|
||||
local max_idle_perc = 0
|
||||
|
||||
local hash_tables_stats = interface.getHashTablesStats()
|
||||
for ht_name, ht_stats in pairsByKeys(hash_tables_stats, asc) do
|
||||
local idle = ht_stats["hash_entry_states"]["hash_entry_state_idle"] or 0
|
||||
local active = ht_stats["hash_entry_states"]["hash_entry_state_active"] or 0
|
||||
local idle_perc = math.min(idle * 100.0 / (idle + active + 1), 100)
|
||||
if (idle + active) > 1024 and idle_perc > threshold then
|
||||
if idle_perc > max_idle_perc then
|
||||
max_idle = idle
|
||||
max_idle_perc = idle_perc
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local alert = alert_consts.alert_types.alert_slow_purge.new(
|
||||
max_idle,
|
||||
max_idle_perc,
|
||||
threshold
|
||||
)
|
||||
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(getInterfaceName(interface.getId()))
|
||||
|
||||
if max_idle_perc > threshold then
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
else
|
||||
alert:release(params.alert_entity, nil, params.cur_alerts)
|
||||
end
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
script.hooks.min = check_interface_idle
|
||||
|
||||
-- #################################################################
|
||||
|
||||
return script
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
--
|
||||
-- (C) 2019-24 - ntop.org
|
||||
--
|
||||
|
||||
local alerts_api = require("alerts_api")
|
||||
local alert_consts = require("alert_consts")
|
||||
local checks = require("checks")
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.network,
|
||||
|
||||
default_enabled = false,
|
||||
|
||||
default_value = {
|
||||
-- "> 5%"
|
||||
operator = "gt",
|
||||
threshold = 80,
|
||||
},
|
||||
|
||||
severity = alert_consts.get_printable_severities().error,
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.throughput",
|
||||
i18n_description = "alerts_thresholds_config.alert_throughput_description",
|
||||
i18n_field_unit = checks.field_units.percentage,
|
||||
input_builder = "threshold_cross",
|
||||
field_max = 99,
|
||||
field_min = 1,
|
||||
field_operator = "gt";
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.min(params)
|
||||
local interface_bytes = params.entity_info["stats"]["bytes"]
|
||||
local interface_speed = params.entity_info["speed"]
|
||||
local perc_threshold = tonumber(params.check_config.threshold)
|
||||
local threshold = interface_speed * (perc_threshold / 100)
|
||||
|
||||
-- Delta
|
||||
local value = alerts_api.interface_delta_val(script.key, params.granularity, interface_bytes)
|
||||
-- Granularity
|
||||
value = value / alert_consts.granularity2sec(params.granularity)
|
||||
-- Bytes to Mbit, the Interface speed is in Mbit
|
||||
value = (value * 8) / 1000000
|
||||
|
||||
local alert = alert_consts.alert_types.alert_threshold_cross.new(
|
||||
params.check.key,
|
||||
value,
|
||||
params.check_config.operator,
|
||||
threshold
|
||||
)
|
||||
|
||||
alert:set_info(params)
|
||||
|
||||
if(value > threshold) then
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
else
|
||||
alert:release(params.alert_entity, nil, params.cur_alerts)
|
||||
end
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
return script
|
||||
Loading…
Add table
Add a link
Reference in a new issue