mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Plugins are a convenient way to group together related lua scripts. Their primary use case is to group user scripts and their alert/status definition. The builtin ntopng user scripts and definitions are now packed into plugins directories. In future, we will support loading of user created plugins. Plugins are loaded at startup into some runtime directories and then used. Other changes provided by this commit include: - Add sample flow logger plugin - Initial support for system user scripts - Rename edge to threshold - Migrate system probes to user scripts/plugins - Migrate scripts to more explicit alerts_api.checkThresholdAlert api
34 lines
974 B
Lua
34 lines
974 B
Lua
--
|
|
-- (C) 2018 - ntop.org
|
|
--
|
|
|
|
local dirs = ntop.getDirs()
|
|
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|
|
|
require "lua_utils"
|
|
local ts_utils = require("ts_utils")
|
|
local json = require "dkjson"
|
|
local user_scripts = require("user_scripts")
|
|
|
|
local driver = ts_utils.getQueryDriver()
|
|
local probe = user_scripts.loadModule(getSystemInterfaceId(), user_scripts.script_types.system, "system", "influxdb_monitor")
|
|
|
|
local info = {}
|
|
|
|
if driver.getInfluxdbVersion then
|
|
info.version = driver:getInfluxdbVersion()
|
|
info.db_bytes = driver:getDiskUsage()
|
|
info.memory = driver:getMemoryUsage()
|
|
info.num_series = driver:getSeriesCardinality()
|
|
|
|
if(probe ~= nil) then
|
|
local stats = probe.getExportStats()
|
|
info.points_exported = stats.points_exported
|
|
info.points_dropped = stats.points_dropped
|
|
info.exports = stats.exports
|
|
info.health = stats.health
|
|
end
|
|
end
|
|
|
|
sendHTTPContentTypeHeader('application/json')
|
|
print(json.encode(info))
|