Plugin design
Let's look at how plugins communicate with Cacti and the plugin architecture.
The plugin architecture introduced several hooks into Cacti that can be used by plugins to:
- Display additional information
- Add functionality to a core Cacti function
- Manipulate data and graphs
Let's look at some of these hooks now.
Plugin hooks
Each plugin needs to register for a hook. Let's explore version 4.1 of the cycle plugin as it is one of the simpler plugins available.
Note
You can retrieve the latest version of the Cycle plugin from the following GitHub page:https://github.com/Cacti/plugin_cycle
Right at the top, the setup.php
file contains the following function:
function plugin_cycle_install() { api_plugin_register_hook('cycle', 'top_header_tabs', 'cycle_show_tab', 'setup.php'); api_plugin_register_hook('cycle', 'top_graph_header_tabs', 'cycle_show_tab', 'setup.php'); api_plugin_register_hook('cycle', 'config_arrays', 'cycle_config_arrays', 'setup...