mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 09:20:10 +00:00
Addresses #3720 Alerts Refactor: alert_utils as module Alerts Refactor: notify_ntopng_start and notify_ntopng_stop Alerts Refactor: processAlertNotifications Alerts Refactor: checkStoreAlertsFromC Alerts Refactor: formatAlertNotification Alerts Refactor: notification_timestamp_rev Alerts Refactor: formatAlertMessage Alerts Refactor: getConfigsetAlertLink Alerts Refactor: alertNotificationActionToLabel Alerts Refactor: flushAlertsData Alerts Refactor: disableAlertsGeneration Alerts Refactor: newAlertsWorkingStatus and other Alerts Refactor: drawAlerts Alerts Refactor: drawAlertTables Alerts Refactor: printAlertTables Alerts Refactor: checkDeleteStoredAlerts Alerts Refactor: getUnpagedAlertOptions Alerts Refactor: getTabParameters Alerts Refactor: getAlerts Alerts Refactor: getNumAlerts Alerts Refactor: performAlertsQuery Alerts Refactor: sec2granularity Alerts Refactor: granularity2id Alerts Refactor: granularity2sec Alerts Refactor: alertEngineLabel Alerts Refactor: alertEngine Alerts Refactor: alertEngineRaw Alerts Refactor: alertTypeDescription Alerts Refactor: alertType Alerts Refactor: alertTypeLabel Alerts Refactor: alertTypeRaw Alerts Refactor: alertSeverity Alerts Refactor: alertSeverityLabel Alerts Refactor: alertSeverityRaw Alerts Refactor: get_make_room_keys Alerts Refactor: enterprise_alert_utils
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
--
|
|
-- (C) 2019-20 - ntop.org
|
|
--
|
|
|
|
local alerts_api = require("alerts_api")
|
|
local alert_consts = require("alert_consts")
|
|
local user_scripts = require("user_scripts")
|
|
|
|
local script = {
|
|
-- Script category
|
|
category = user_scripts.script_categories.network,
|
|
|
|
default_enabled = false,
|
|
|
|
-- This script is only for alerts generation
|
|
is_alert = true,
|
|
|
|
-- See below
|
|
hooks = {},
|
|
|
|
gui = {
|
|
i18n_title = "alerts_thresholds_config.throughput",
|
|
i18n_description = "alerts_thresholds_config.alert_throughput_description",
|
|
i18n_field_unit = user_scripts.field_units.mbits,
|
|
input_builder = "threshold_cross",
|
|
}
|
|
}
|
|
|
|
-- #################################################################
|
|
|
|
function script.hooks.all(params)
|
|
local value = alerts_api.interface_delta_val(script.key, params.granularity, params.entity_info["stats"]["bytes"]) * 8 / alert_consts.granularity2sec(params.granularity)
|
|
|
|
-- Check if the configured threshold is crossed by the value and possibly trigger an alert
|
|
alerts_api.checkThresholdAlert(params, alert_consts.alert_types.alert_threshold_cross, value)
|
|
end
|
|
|
|
-- #################################################################
|
|
|
|
return script
|