Plugins provide an option to extend monitoring capabilities of Áú»¢¶Ä²©. A plugin is a Go package that defines the structure and implements one or several plugin interfaces (Exporter, Collector, Configurator, Runner, Watcher).
Plugins are supported only by Áú»¢¶Ä²© agent 2. Since Áú»¢¶Ä²© 6.0 two types of Áú»¢¶Ä²© agent 2 plugins are supported:
To ensure that the plugin meets all the quality requirements, the guidelines given in corresponding sub pages for building loadable or built-in plugins should be followed.
Note that loadable plugins have an advantage compared to the built-in plugins, as the loadable ones do not require recompiling Áú»¢¶Ä²© agent while agent upgrading process.
Since Áú»¢¶Ä²© 6.0, all the built-in plugin configuration parameters are located in . All the configuration parameters for , including an example repository, , are located in a separate repository.
By default, plugins are inactive and activated only when a metric is provided by the plugin being monitored.
Built-in plugins are located in the plugin directory tree, grouped by meaning, for example plugins/system/uptime/uptime.go
.
The following plugin interfaces are available:
Exporter is the simplest interface that performs a poll and returns a value (values), nothing, or error. It accepts a preparsed item key, parameters and context. Exporter interface is the only interface that can be accessed concurrently. Access to all the other plugin interfaces is exclusive and no method can be called when a plugin is already performing some task. Also, there is a limit of 100 maximum concurrent Export() calls per plugin, which can be reduced according to the requirements for each plugin.
Collector is used when a plugin needs to collect data at regular intervals. This interface is usually used together with the Exporter interface to export the collected data.
Configurator is used to provide a plugin its configuration parameters from the agent 2 configuration files.
Runner interface provides the means for performing some initialization when a plugin is started (activated) and deinitialization when a plugin is stopped (deactivated). For example, a plugin could start/stop some background goroutine by implementing the Runner interface.
Watcher allows a plugin to implement polling of its own metric, without using the agent's internal scheduler, for example in trap-based plugins.
Loadable Áú»¢¶Ä²© agent 2 plugins are supported since Áú»¢¶Ä²© 6.0.0. Such plugins are kept in a separate repository, but use a shared with Áú»¢¶Ä²© agent 2 package.
Loadable plugins need to be compiled and built separately. Plugin configuration shall be provided in a separate Áú»¢¶Ä²© agent 2 configuration file in the same way as it is provided for built-in plugins.
Loadable plugins support the following interfaces: - Exporter (except the ContextProvider parameter) - Runner - Configurator
Watcher and Collector interfaces are not supported.
To avoid creating duplicate plugins, make sure that a plugin does not already exist in Áú»¢¶Ä²©. Existing built-in plugins are available in Áú»¢¶Ä²© . Existing can be checked here.
Áú»¢¶Ä²© agent 2 plugins are developed separately, but if changes in the Plugin Support library are required it is necessary to follow Plugin Support development guidelines.
When updating plugin-support (Áú»¢¶Ä²© agent 2 Plugins/Plugin Support) project, the go.mod
and go.sum
files in must be updated to reference the updated plugin-support version by commit hash:
go get git.zabbix.com/ap/plugin-support@"plugin-support commit hash"
(this will update the required version in go.mod and go.sum) commit/push updated go.mod and go.sum in Áú»¢¶Ä²© development branchgo get git.zabbix.com/ap/plugin-support@"plugin-support commit hash"
(this will update the required version in go.mod and go.sum)go get git.zabbix.com/ap/plugin-support@"plugin-support commit hash"
(this will update the required version in go.mod and go.sum)