mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Script review
This commit is contained in:
parent
b7b2810e61
commit
b8801431b8
1 changed files with 11 additions and 13 deletions
|
|
@ -7,16 +7,16 @@ local alerts_api = require("alerts_api")
|
|||
local checks = require("checks")
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
-- Script category
|
||||
category = checks.check_categories.internals,
|
||||
|
||||
severity = alert_consts.get_printable_severities().warning,
|
||||
hooks = {},
|
||||
severity = alert_consts.get_printable_severities().warning,
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.interface_periodic_activity_not_executed",
|
||||
i18n_description = "alerts_dashboard.interface_periodic_activity_not_executed_descr",
|
||||
}
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.interface_periodic_activity_not_executed",
|
||||
i18n_description = "alerts_dashboard.interface_periodic_activity_not_executed_descr",
|
||||
}
|
||||
}
|
||||
|
||||
-- #################################################################
|
||||
|
|
@ -25,21 +25,19 @@ local function check_periodic_activity_not_executed(params)
|
|||
local scripts_stats = interface.getPeriodicActivitiesStats()
|
||||
|
||||
for ps_name, ps_stats in pairs(scripts_stats) do
|
||||
local delta = alerts_api.interface_delta_val(script.key..ps_name --[[ metric name --]], params.granularity, ps_stats["num_not_executed"] or 0)
|
||||
local delta = alerts_api.interface_delta_val(script.key..ps_name --[[ metric name --]],
|
||||
params.granularity, ps_stats["num_not_executed"] or 0)
|
||||
|
||||
local alert = alert_consts.alert_types.alert_periodic_activity_not_executed.new(
|
||||
ps_name,
|
||||
ps_stats["last_queued_time"] or 0
|
||||
)
|
||||
ps_stats["last_queued_time"] or 0)
|
||||
|
||||
alert:set_info(params)
|
||||
alert:set_subtype(ps_name)
|
||||
|
||||
if delta > 0 then
|
||||
-- tprint({ps_name = ps_name, s = ">>>>>>>>>>>>>>>>>>>>>> TRIGGER"})
|
||||
alert:trigger(params.alert_entity, nil, params.cur_alerts)
|
||||
else
|
||||
-- tprint({ps_name = ps_name, s = "---------------------- RELEASE"})
|
||||
alert:release(params.alert_entity, nil, params.cur_alerts)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue