manifest.json

Any module needs the manifest.json file. The file must be located in the module's primary directory (for example, zabbix/ui/modules/module_name/manifest.json).

As a bare minimum, manifest.json should specify these fields:

{
           "manifest_version": 2.0,
           "id": "my_ip_address",
           "name": "My IP Address",
           "namespace": "MyIPAddress",
           "version": "1.0"
       }

Parameters supported in manifest.json (press on the parameter name for a detailed description):

Parameter Description Required
manifest_version Manifest version of the module. Yes
id Unique module ID.
name Module name that will be displayed in the Administration section.
namespace PHP namespace for module classes.
version Module version.
type Type of the module. For widget must be set to widget Yes for widgets, otherwise no
widget Widget configuration. Used for widgets only.
actions Actions to register with the module.
assets CSS styles and JavaScript files to include. No
author Module author.
config Default values for custom module options.
description Module description.
url A link to the module description.

manifest_version

Manifest version of the module. Currently, supported version is 2.0.

Type: Double

Example:

"manifest_version": 2.0

id

Module ID. Must be unique. To avoid future naming conflicts, it is recommended to use prefix for modules (author or company name, or any other). For example, if a module is an example for lessons and the module name is "My module", then the ID will be "example_my_module".

Type: String

Example:

"id": "example_my_module"

name

Module name that will be displayed in the Administration section.

Type: String

Example:

"name": "My module"

namespace

PHP namespace for module classes.

Type: String

Example:

"namespace": "ClockWidget"

version

Module version. The version will be displayed in the Administration section.

Type: String

Example:

"version": "1.0"

type

Type of the module. Required for widgets and must equal "widget".

Type: String

Default: "module"

Example:

"type": "widget"

actions

Actions to register with the module. Defining class object key for each action is required, other action keys are optional.

Type: Object

Supported object keys if type is module:

  • write.your.action.name (object) - action name, should be written in lowercase [a-z], separating words with dots. Supports the keys:
    • class (string; required) - action class name.
    • layout (string) - action layout. Supported values: layout.json, layout.htmlpage (default), null.
    • view (string) - action view.

Example:

"actions": {
           "module.example.list": {
               "class": "ExampleList",
               "view": "example.list",
               "layout": "layout.htmlpage"
               }
           }

Supported object keys if type is widget:

  • widget.{id}.view (object) - file and class name for widget view. Replace {id} with the widget's id value (for example, widget.example_clock.view). Supports the keys:
    • class (string; required) - action class name for widget view mode to extend the default CControllerDashboardWidgetView class. The class source file must be located in the actions directory.
    • view (string) - widget view. Must be located in the views directory. If the view file is widget.view.php, which is expected by default, this parameter maybe omitted. If using a different name, specify it here.
  • widget.{id}.edit (object) - file name for widget configuration view. Replace {id} with the widget's id value (for example, widget.example_clock.edit). Supports the keys:
    • class (string; required) - action class name for widget configuration view mode. The class source file must be located in the actions directory.
    • view (string) - widget configuration view. Must be located in the views directory. If the view file is widget.edit.php, which is expected by default, this parameter maybe omitted. If using a different name, specify it here.

Example:

"actions": {
           "widget.tophosts.view": {
               "class": "WidgetView"
           },
           "widget.tophosts.column.edit": {
               "class": "ColumnEdit",
               "view": "column.edit",
               "layout": "layout.json"
           }
       }

assets

CSS styles and JavaScript files to include.

Type: Object

Supported object keys:

  • css (array) - CSS files to include. The files must be located in the assets/css.
  • js (array) - JavaScript files to include. The files must be located in the assets/js.

Example:

"assets": {
           "css": ["widget.css"],
           "js": ["class.widget.js"]
       }

author

Module author. The author will be displayed in the Administration section.

Type: String

Example:

"author": "John Smith"

config

Default values for the module options. The object may contain any custom keys. If specified, these values will be written into the database during module registration. New variables added later will be written upon the first call. Afterwards, the variable values can only be changed directly in the database.

Type: Object

Example:

"config": {
           "username": "Admin",
           "password": "",
           "auth_url": "https://example.com/auth"
       }

description

Module description.

Type: String

Example:

"description": "This is a clock widget."

widget

Widget configuration. Used, if type is set to widget.

Type: Object

Supported object keys:

  • name (string) - used in the widget list and as default header. If empty, "name" parameter from the module will be used.

  • template_support (boolean) - determines whether the widget should be available in template dashboards. Supported values: true, false (default).

  • size (object) - default widget dimensions. Supports keys:

    • width (integer) - default widget width.
    • height (integer) - default widget height.
  • form_class (string) - class with widget fields form. Must be located in the includes directory. If the class is WidgetForm.php, which is expected by default, this parameter maybe omitted. If using a different name, specify it here.

  • js_class (string) - name of a JavaScript class for widget view mode to extend the default CWidget class. The class will be loaded with the dashboard. The class source file must be located in the assets/js directory. See also: assets.

  • use_time_selector (boolean) - determines whether the widget requires dashboard time selector. Supported values: true, false (default).

  • refresh_rate (integer) - widget refresh rate in seconds (default: 60).

Example:

"widget": {
           "name": "",                       
           "template_support": true,      
           "size": {                       
               "width": 12,
               "height": 5
           },
           "form_class": "WidgetForm", 
           "js_class": "CWidget",         
           "use_time_selector": false,    
           "refresh_rate": 60             
       }

url

A link to the module description.

Type: String

Example:

"url": "http://example.com"