Каждому модулю необходим файл manifest.json. Файл должен располагаться в главной директории модуля (например, zabbix/ui/modules/module_name/manifest.json).
Как необходимый минимум, файл manifest.json должен содержать следующие поля:
{
"manifest_version": 2.0,
"id": "my_ip_address",
"name": "My IP Address",
"namespace": "MyIPAddress",
"version": "1.0"
}
Параметры, поддерживаемые manifest.json (нажмите на параметр для более подробной информации):
Параметр | Описание | Обязателен |
---|---|---|
manifest_version | Версия манифеста модуля. | Да |
id | Уникальный ID модуля. | |
name | Имя модуля, которое будет отображаться в разделе Администрирование. | |
namespace | Пространство имён PHP для классов модуля. | |
version | Версия модуля. | |
type | Тип модуля. Для виджетов необходимо указать widget | Да для виджетов, для остальных нет |
widget | Конфигурация виджета. Используется только для виджетов. | |
actions | Действия для регистрации модуля. | |
assets | Стили CSS и файлы JavaScript, которые необходимо включить. | Нет |
author | Автор модуля. | |
config | Значения по умолчанию для пользовательских параметров модуля. | |
description | Описание модуля. | |
url | Ссылка на описание модуля. |
Версия манифеста модуля. На данный момент поддерживается версия 2.0. Тип: Double
Пример:
Идентификатор модуля. Должен быть уникальным. Чтобы избежать конфликта имён в будущем, рекомендуется использовать для модулей префикс (имя автора или название компании, или любой другой). Например, если модуль является примером для уроков и имя модуля «My module», то идентификатор будет «example_my_module».
Тип: String
Пример:
Имя модуля, которое будет отображаться в секторе Администрирование.
Тип: String
Пример
Пространство имён PHP для классов модулей
Тип: String
Пример:
Версия модуля. Версия будет отображаться в секторе Администрирование.
Тип: String
Пример:
Type of the module. Required for widgets and must equal "widget".
Type: String
Default: "module"
Example:
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:
Example:
"actions": {
"module.example.list": {
"class": "ExampleList",
"view": "example.list",
"layout": "layout.htmlpage"
}
}
Supported object keys if type is widget:
Example:
"actions": {
"widget.tophosts.view": {
"class": "WidgetView"
},
"widget.tophosts.column.edit": {
"class": "ColumnEdit",
"view": "column.edit",
"layout": "layout.json"
}
}
CSS styles and JavaScript files to include.
Type: Object
Supported object keys:
Example:
Module author. The author will be displayed in the Administration section.
Type: String
Example:
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:
Module description.
Type: String
Example:
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:
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
}
A link to the module description.
Type: String
Example: