mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 10:41:34 +00:00
Adds plugin user script to write system alert timeseries
This commit is contained in:
parent
19dabd2c97
commit
5695d2c190
1 changed files with 46 additions and 0 deletions
46
scripts/plugins/timeseries/user_scripts/system/alerts_ts.lua
Normal file
46
scripts/plugins/timeseries/user_scripts/system/alerts_ts.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
--
|
||||
-- (C) 2019-20 - ntop.org
|
||||
--
|
||||
|
||||
local ts_utils = require("ts_utils_core")
|
||||
local user_scripts = require("user_scripts")
|
||||
local system_utils = require("system_utils")
|
||||
|
||||
local script = {
|
||||
-- Script category
|
||||
category = user_scripts.script_categories.system,
|
||||
|
||||
-- This module is enabled by default
|
||||
default_enabled = true,
|
||||
|
||||
-- No default configuration is provided
|
||||
default_value = {},
|
||||
|
||||
-- See below
|
||||
hooks = {},
|
||||
|
||||
gui = {
|
||||
i18n_title = "alerts_dashboard.alerts_ts",
|
||||
i18n_description = "alerts_dashboard.alerts_ts_description",
|
||||
},
|
||||
}
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function script.hooks.min(params)
|
||||
if params.ts_enabled then
|
||||
local system_host_stats = system_utils.systemHostStats()
|
||||
|
||||
ts_utils.append("process:num_alerts",
|
||||
{
|
||||
ifid = getSystemInterfaceId(),
|
||||
dropped_alerts = system_host_stats.dropped_alerts or 0,
|
||||
written_alerts = system_host_stats.written_alerts or 0,
|
||||
alerts_queries = system_host_stats.alerts_queries or 0
|
||||
}, when, verbose)
|
||||
end
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
return script
|
||||
Loading…
Add table
Add a link
Reference in a new issue