mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
parent
81f55a02a4
commit
f7e1ea9709
164 changed files with 106 additions and 84 deletions
|
|
@ -0,0 +1,41 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.activity_time",
|
||||
i18n_description = "alerts_thresholds_config.alert_active_description",
|
||||
i18n_field_unit = user_scripts.field_units.seconds,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, host.getTime()["total_activity_time"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.alert_bytes_title",
|
||||
i18n_description = "alerts_thresholds_config.alert_bytes_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local host_bytes = host.getBytes()
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, host_bytes["bytes.sent"] + host_bytes["bytes.rcvd"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.dns_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_dns_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
},
|
||||
|
||||
env = {
|
||||
dns_app_id = interface.getnDPIProtoId("DNS")
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, host.getApplicationBytes(script.env.dns_app_id))
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.alert_flows_title",
|
||||
i18n_description = "alerts_thresholds_config.alert_flows_description",
|
||||
i18n_field_unit = user_scripts.field_units.flows,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local nf = host.getNumFlows()
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, nf["total_flows.as_client"] + nf["total_flows.as_server"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.idle_time",
|
||||
i18n_description = "alerts_thresholds_config.alert_idle_description",
|
||||
i18n_field_unit = user_scripts.field_units.seconds,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, os.time() - host.getTime()["seen.last"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.p2p_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_p2p_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
},
|
||||
|
||||
env = {
|
||||
p2p_app_id = interface.getnDPICategoryId("FileSharing")
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, host.getCategoryBytes(script.env.p2p_app_id)["bytes"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
default_enabled = false,
|
||||
|
||||
-- This script is only for alerts generation
|
||||
is_alert = true,
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_thresholds_config.alert_packets_title",
|
||||
i18n_description = "alerts_thresholds_config.alert_packets_description",
|
||||
i18n_field_unit = user_scripts.field_units.packets,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local num_packets = host.getPackets()
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, num_packets["packets.sent"] + num_packets["packets.rcvd"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
--
|
||||
-- (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,
|
||||
|
||||
local_only = true,
|
||||
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 host_bytes = host.getBytes()
|
||||
|
||||
-- Delta
|
||||
local value = alerts_api.host_delta_val(script.key, params.granularity, host_bytes["bytes.sent"] + host_bytes["bytes.rcvd"])
|
||||
-- Granularity
|
||||
value = value / alert_consts.granularity2sec(params.granularity)
|
||||
-- Bytes to Mbit
|
||||
value = (value * 8) / 1000000
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.active_local_hosts",
|
||||
i18n_description = "alerts_thresholds_config.active_local_hosts_threshold_descr",
|
||||
i18n_field_unit = user_scripts.field_units.hosts,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = params.entity_info["stats"]["local_hosts"]
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.alert_bytes_title",
|
||||
i18n_description = "alerts_thresholds_config.alert_bytes_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
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"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.dns_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_dns_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.interface_delta_val(script.key, params.granularity, alerts_api.application_bytes(params.entity_info, "DNS"))
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.idle_time",
|
||||
i18n_description = "alerts_thresholds_config.alert_idle_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, os.time() - params.entity_info["seen.last"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.p2p_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_p2p_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.interface_delta_val(script.key, params.granularity, alerts_api.category_bytes(params.entity_info, "FileSharing"))
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.alert_packets_title",
|
||||
i18n_description = "alerts_thresholds_config.alert_packets_description",
|
||||
i18n_field_unit = user_scripts.field_units.packets,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.interface_delta_val(script.key, params.granularity, params.entity_info["stats"]["packets"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
--
|
||||
-- (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 interface_bytes = params.entity_info["stats"]["bytes"]
|
||||
|
||||
-- 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
|
||||
value = (value * 8) / 1000000
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.egress_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_network_egress_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.network_delta_val(script.key, params.granularity, params.entity_info["egress"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.ingress_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_network_ingress_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.network_delta_val(script.key, params.granularity, params.entity_info["ingress"])
|
||||
|
||||
-- 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
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (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.inner_traffic",
|
||||
i18n_description = "alerts_thresholds_config.alert_network_inner_description",
|
||||
i18n_field_unit = user_scripts.field_units.bytes,
|
||||
input_builder = "threshold_cross",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
||||
function script.hooks.all(params)
|
||||
local value = alerts_api.network_delta_val(script.key, params.granularity, params.entity_info["inner"])
|
||||
|
||||
-- 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue