Implement ntopng plugins

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
This commit is contained in:
emanuele-f 2019-12-04 11:34:18 +01:00
parent df245fad3a
commit a3432e00e8
218 changed files with 2070 additions and 2097 deletions

View file

@ -9,7 +9,7 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
local ts_utils = require("ts_utils_core")
local system_scripts = require("system_scripts_utils")
local plugins_utils = require("plugins_utils")
sendHTTPHeader('application/json')
@ -89,7 +89,7 @@ function dumpInterfaceStats(ifid)
res["has_alerts"] = ifstats["has_alerts"]
res["ts_alerts"] = {}
if ts_utils.getDriverName() == "influxdb" and system_scripts.hasAlerts({entity = alert_consts.alertEntity("influx_db")}) then
if ts_utils.getDriverName() == "influxdb" and plugins_utils.hasAlerts(getSystemInterfaceId(), {entity = alert_consts.alertEntity("influx_db")}) then
res["ts_alerts"]["influxdb"] = true
end
end