On this page
Module file structure
All code related to a module is stored in a single directory inside zabbix/ui/modules/.
Module file tree
example_module_directory/ (required)
manifest.json (required) Metadata and action definition.
Module.php Module initialization and event handling.
actions/ Action controller files.
SomethingView.php
SomethingCreate.php
SomethingDelete.php
data_export/
ExportAsXml.php
ExportAsExcel.php
views/ View files.
example.something.view.php
example.something.delete.php
assets/ Any additional files to be used in views. Must be specified in manifest.json.
js/ JavaScript files used in views.
example.something.view.js.php
css/ CSS files used in views.
example.something.css
image.png Images used in views.
example.something.file Any file for using in views.
Writing a module
A sample module writing process consists of the following steps (where available, click on the file or folder name to view additional details about the step):
- Create a new directory for the module inside zabbix/ui/modules/.
- Add manifest.json file with module metadata.
- Create views folder and define a module view(s).
- Create actions folder and define a module action(s).
- Create Module.php (or Widget.php for dashboard widgets) file and define initialization and event handling rules.
- Create assets folder for JavaScript files (place into assets/js), CSS styles (place into assets/css), or any other additional files.
- Make sure to specify required views, actions and asset files in the manifest.json.
- Register the module in Zabbix frontend and start using it.
You can register and enable a module as soon as you create manifest.json file. Once the module is enabled, you can preview all changes made to module files immediately by refreshing Zabbix frontend.