Plugin design
Let's look at how plugins actually communicate with Cacti and the Plugin Architecture.
As mentioned earlier, the Plugin Architecture introduced several hooks into Cacti. Plugins can use these hooks 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 to use. Let's have a look into the ntop plugin as it is one of the simplest plugins available.
Right at the top, the setup.php
file contains the following function:
function plugin_ntop_install() { api_plugin_register_hook('ntop', 'top_header_tabs', 'ntop_show_tab', "setup.php"); api_plugin_register_hook('ntop', 'top_graph_header_tabs', 'ntop_show_tab', "setup.php"); api_plugin_register_hook('ntop', 'draw_navigation_text', 'ntop_draw_navigation_text', "setup.php"); api_plugin_register_hook('ntop', 'config_settings', 'ntop_config_settings', ...