mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 08:50:12 +00:00
Implements additional plugin hooks
The following plugin hooks have been implemented onEnable(hook, hook_config) onDisable(hook, hook_config) onUpdateConfig(hook, hook_config) onLoad(hook, hook_config) onUnload(hook, hook_config) Documentation is part of the commit. Implements #4451 Implements #4453 Implements #4454 Implements #4455
This commit is contained in:
parent
f83ccb70d5
commit
3ad4522e45
5 changed files with 146 additions and 40 deletions
|
|
@ -71,23 +71,57 @@ local script = {
|
|||
|
||||
-- #################################################################
|
||||
|
||||
-- @brief Called when the plugin containing the user script is loaded/reloaded
|
||||
-- @brief Called, for every enabled hook, upon ntopng startup or upon plugins reload at runtime
|
||||
-- @param hook The name of the enabled hook (e.g., min, hour)
|
||||
-- @param hook_config A Lua table with the hook configuration
|
||||
-- @return nil
|
||||
function script.onLoad()
|
||||
function script.onLoad(hook, hook_config)
|
||||
tprint("loading: "..hook)
|
||||
-- tprint(hook_config)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
-- @brief Called when the plugin containing the user script is loaded/reloaded
|
||||
-- or when the user script configuration changes (e.g., is on/off toggled or
|
||||
-- configuration parameters are changed).
|
||||
-- When the plugin is loaded/reloaded, this method is called with all the
|
||||
-- available existing configurations.
|
||||
-- @param confid An integer configuration id
|
||||
-- @param config A lua table with the configuration parameters for `confid`
|
||||
function script.onUpdateConfig(confid, config)
|
||||
print("on update:" .. script.key.. " confid: "..confid.."\n")
|
||||
tprint(config)
|
||||
-- @brief Called, for every enabled hook, upon ntopng termination
|
||||
-- @param hook The name of the enabled hook (e.g., min, hour)
|
||||
-- @param hook_config A Lua table with the hook configuration
|
||||
-- @return nil
|
||||
function script.onUnload(hook, hook_config)
|
||||
tprint("unloading: "..hook)
|
||||
-- tprint(hook_config)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
-- @brief Called when a user script hook is enabled
|
||||
-- @param hook The name of the enabled hook (e.g., min, hour)
|
||||
-- @param hook_config A Lua table with the hook configuration for the enabled hook
|
||||
-- @return nil
|
||||
function script.onEnable(hook, hook_config)
|
||||
tprint("[+] enabling: "..hook)
|
||||
-- tprint(hook_config)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
-- @brief Called when a user script hook is disabled
|
||||
-- @param hook The name of the disabled hook (e.g., min, hour)
|
||||
-- @param hook_config A Lua table with the hook configuration for the disabled hook
|
||||
-- @return nil
|
||||
function script.onDisable(hook, hook_config)
|
||||
tprint("[-] disabling: "..hook)
|
||||
-- tprint(hook_config)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
||||
-- @brief Called when the configuration for an enabled user script hook has changed
|
||||
-- @param hook The name of the hook (e.g., min, hour) for which the configuration has changed
|
||||
-- @param hook_config A Lua table with the new (changed) configuration
|
||||
-- @return nil
|
||||
function script.onUpdateConfig(hook, hook_config)
|
||||
tprint("[~] config change: "..hook)
|
||||
-- tprint(hook_config)
|
||||
end
|
||||
|
||||
-- #################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue