Refactors user_scripts into checks (lua)

This commit is contained in:
Simone Mainardi 2021-06-16 18:02:22 +02:00
parent 3c3aa5a25f
commit 76fd315d1b
222 changed files with 980 additions and 981 deletions

View file

@ -3,7 +3,7 @@
--
local alerts_api = require("alerts_api")
local user_scripts = require("user_scripts")
local checks = require("checks")
local alert_consts = require("alert_consts")
local script
@ -14,7 +14,7 @@ local function check_interface_drops(params)
local alert_consts = require "alert_consts"
local info = params.entity_info
local stats = info.stats_since_reset
local threshold = tonumber(params.user_script_config.threshold)
local threshold = tonumber(params.check_config.threshold)
local drop_perc = math.min(stats.drops * 100.0 / (stats.drops + stats.packets + 1), 100)
local alert = alert_consts.alert_types.alert_too_many_drops.new(
@ -37,7 +37,7 @@ end
script = {
-- Script category
category = user_scripts.script_categories.system,
category = checks.script_categories.system,
default_enabled = true,
default_value = {
@ -56,7 +56,7 @@ script = {
gui = {
i18n_title = "show_alerts.interface_drops_threshold",
i18n_description = "show_alerts.interface_drops_threshold_descr",
i18n_field_unit = user_scripts.field_units.percentage,
i18n_field_unit = checks.field_units.percentage,
input_builder = "threshold_cross",
field_max = 99,
field_min = 1,