这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

Sidebar

14 Plugins

Overview

Plugins provide an option to extend the monitoring capabilities of Zabbix. Plugins are written in the Go programming language and are supported by Zabbix agent 2 only.

Plugins provide an alternative to loadable modules (written in C), and other methods for extending Zabbix functionality, such as user parameters (agent metrics), external checks (agent-less monitoring), and system.run[] Zabbix agent item.

The following features are specific to agent 2 and its plugins:

  • single configuration file (all plugin configuration parameters are located in the same file as parameters of the agent itself);
  • task queue management with respect to schedule and task concurrency;
  • plugin-level timeouts.

Configuring plugins

Common configuration principles and best practices are described in this section.

All plugins are configured using Plugins.* parameter of the Zabbix agent 2 configuration file. Unlike other agent parameters, it is not a key/value type of parameter. It is a separate section where specific parameters of the plugin can be described. Each parameter should have the following structure:

Plugins.<PluginName>.<Parameter>=<Value>

Parameter names should adhere to the following requirements:

  • it is recommended to capitalize the names of your plugins;
  • the parameter should be capitalized;
  • special characters are not allowed;
  • nesting isn’t limited by a maximum level;
  • the number of parameters is not limited.
Named sessions

Named sessions represent an additional level of plugin parameters and can be used to define separate sets of authentication parameters for each of the instances being monitored. Each named session parameter should have the following structure:

Plugins.<PluginName>.<SessionName>.<Parameter>=<Value>

A session name can be used as a connString item key parameter instead of specifying a URI, username, and password separately. In item keys, the first parameter can be either a connString or a Uri. If the first key parameter matches a session name specified in the configuration file, the check will be executed using named session parameters. If the first key parameter doesn't match any session name, it will be treated as a Uri.

Note, that:

  • when providing a connString (session name) in key parameters, key parameters for username and password must be empty;
  • passing embedded URI credentials is not supported, consider using named sessions instead;
  • in case an authentication parameter is not specified for the named session, a hardcoded default value will be used.

The list of available named session parameters depends on the plugin, see Zabbix agent 2 (UNIX) / Zabbix agent 2 (Windows) for details.

Example: Monitoring of two instances “MySQL1” and “MySQL2” can be configured in the following way:

Plugins.Mysql.Sessions.MySQL1.Uri=tcp://127.0.0.1:3306
       Plugins.Mysql.Sessions.MySQL1.User=<UsernameForMySQL1>
       Plugins.Mysql.Sessions.MySQL1.Password=<PasswordForMySQL1>    
       Plugins.Mysql.Sessions.MySQL2.Uri=tcp://127.0.0.1:3307   
       Plugins.Mysql.Sessions.MySQL2.User=<UsernameForMySQL2>
       Plugins.Mysql.Sessions.MySQL2.Password=<PasswordForMySQL2>

Now, these names may be used as connStrings in keys instead of URIs:

mysql.ping[MySQL1]
       mysql.ping[MySQL2]
Hardcoded defaults

If a parameter required for authentication is not provided in an item key or in the named session parameters, the plugin will use a hardcoded default value.

Connections

Some plugins support gathering metrics from multiple instances simultaneously. Both local and remote instances can be monitored. TCP and Unix-socket connections are supported.

It is recommended to configure plugins to keep connections to instances in an open state. The benefits are reduced network congestion, latency, and CPU and memory usage due to the lower number of connections. The client library takes care of this.

Time period for which unused connections should remain open can be determined by Plugins.<PluginName>.KeepAlive parameter.
Example: Plugins.Memcached.KeepAlive

Plugins supplied out-of-the-box

All metrics supported by Zabbix agent 2 are collected by plugins. The following plugins for Zabbix agent 2 are available out-of-the-box:

Plugin name Description Supported item keys Comments
Agent Metrics of the Zabbix agent being used. agent.hostname, agent.ping, agent.version Supported keys have the same parameters as Zabbix agent keys.
Ceph Ceph monitoring. ceph.df.details, ceph.osd.stats, ceph.osd.discovery, ceph.osd.dump,
ceph.ping, ceph.pool.discovery, ceph.status
Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
CPU System CPU monitoring (number of CPUs/CPU cores, discovered CPUs, utilization percentage). system.cpu.discovery, system.cpu.num, system.cpu.util Supported keys have the same parameters as Zabbix agent keys.
Docker Monitoring of Docker containers. docker.container_info, docker.container_stats, docker.containers, docker.containers.discovery,
docker.data_usage, docker.images, docker.images.discovery, docker.info, docker.ping
Supported keys can be used with Zabbix agent 2 only.

See also:
Plugin configuration parameters (Unix/Windows)
File File metrics collection. vfs.file.cksum, vfs.file.contents, vfs.file.exists, vfs.file.md5sum,
vfs.file.regexp, vfs.file.regmatch, vfs.file.size, vfs.file.time
Supported keys have the same parameters as Zabbix agent keys.
Kernel Kernel monitoring. kernel.maxfiles, kernel.maxproc Supported keys have the same parameters as Zabbix agent keys.
Log Log file monitoring. log, log.count, logrt, logrt.count Supported keys have the same parameters as Zabbix agent keys.

See also:
Plugin configuration parameters (Unix/Windows)
Memcached Memcached server monitoring. memcached.ping, memchached.stats Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
Modbus Reads Modbus data. modbus.get Supported keys have the same parameters as Zabbix agent keys.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
Mongo DB Monitoring of MongoDB servers and clusters (document-based, distributed database). mongodb.collection.stats, mongodb.collections.discovery, mongodb.collections.usage, mongodb.connpool.stats,
mongodb.db.stats, mongodb.db.discovery, mongodb.jumbo_chunks.count, mongodb.oplog.stats,
mongodb.ping, mongodb.rs.config, mongodb.rs.status, mongodb.server.status,
mongodb.sh.discovery
Supported MongoDB versions: 3.6, 4.0, 4.2, 4.4.

Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
MQTT Receives published values of MQTT topics. mqtt.get Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
MySQL Monitoring of MySQL and its forks. mysql.db.discovery, mysql.db.size, mysql.get_status_variables,
mysql.ping, mysql.replication.discovery, mysql.replication.get_slave_status, mysql.version
To configure encrypted connection to the database, use named sessions and specify TLS parameters for the named session in the agent configuration file. Currently, TLS parameters cannot be passed as item key parameters.

Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
NetIf Monitoring of network interfaces. net.if.collisions, net.if.discovery, net.if.in, net.if.out, net.if.total Supported keys have the same parameters as Zabbix agent keys.
Oracle Oracle Database monitoring. oracle.diskgroups.stats, oracle.diskgroups.discovery, oracle.archive.info, oracle.archive.discovery,
oracle.cdb.info, oracle.custom.query, oracle.datafiles.stats, oracle.db.discovery,
oracle.fra.stats, oracle.instance.info, oracle.pdb.info, oracle.pdb.discovery,
oracle.pga.stats, oracle.ping, oracle.proc.stats, oracle.redolog.info,
oracle.sga.stats, oracle.sessions.stats, oracle.sys.metrics, oracle.sys.params,
oracle.ts.stats, oracle.ts.discovery, oracle.user.info
Install the Oracle Instant Client before using the plugin.

Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
PostgreSQL Monitoring of PostgreSQL and its forks. pgsql.ping, pgsql.db.discovery, pgsql.db.size, pgsql.db.age, pgsql.database.bloating_tables,
pgsql.replication_lag.sec, pgsql.replication_lag.b, pgsql.replication.count, pgsql.replication.status, pgsql.replication.recovery_role,
pgsql.cache.hit, pgsql.connections, pgsql.archive, pgsql.bgwriter, pgsql.dbstat.sum, pgsql.dbstat,
pgsql.wal.stat, pgsql.locks, pgsql.pgsql.oldest.xid, pgsql.uptime
To configure encrypted connection to the database, use named sessions and specify TLS parameters for the named session in the agent configuration file. Currently, TLS parameters cannot be passed as item key parameters.

Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
Proc Process CPU utilization percentage. proc.cpu.util Supported key has the same parameters as Zabbix agent key.
Redis Redis server monitoring. redis.config, redis.info, redis.ping, redis.slowlog.count Supported keys can be used with Zabbix agent 2 only.

See also:
- Plugin documentation
- Plugin configuration parameters (Unix/Windows)
Smart S.M.A.R.T. monitoring. smart.attribute.discovery, smart.disk.discovery, smart.disk.get Sudo/root access rights to smartctl are required for the user executing Zabbix agent 2. The minimum required smartctl version is 7.1.

Supported keys can be used with Zabbix agent 2 only on Linux/Windows, both as a passive and active check.
Swap Swap space size in bytes/percentage. system.swap.size Supported key has the same parameters as Zabbix agent key.
SystemRun Runs specified command. system.run Supported key has the same parameters as Zabbix agent key.

See also:
Plugin configuration parameters (Unix/Windows)
Systemd Monitoring of systemd services. systemd.unit.discovery, systemd.unit.get, systemd.unit.info Supported keys can be used with Zabbix agent 2 only.
TCP TCP connection availability check. net.tcp.port Supported key has the same parameters as Zabbix agent key.
UDP Monitoring of the UDP services avaiability and performance. net.udp.service, net.udp.service.perf Supported keys have the same parameters as Zabbix agent keys.
Uname Retrieval of information about the system. system.hostname, system.sw.arch, system.uname Supported keys have the same parameters as Zabbix agent keys.
Uptime System uptime metrics collection. system.uptime Supported key has the same parameters as Zabbix agent key.
VFSDev VFS metrics collection. vfs.dev.discovery, vfs.dev.read, vfs.dev.write Supported keys have the same parameters as Zabbix agent keys.
WebCertificate Monitoring of TLS/SSL website certificates. web.certificate.get Supported key can be used with Zabbix agent 2 only.
WebPage Web page monitoring. web.page.get, web.page.perf, web.page.regexp Supported keys have the same parameters as Zabbix agent keys.
ZabbixAsync Asynchronous metrics collection. net.tcp.listen, net.udp.listen, sensor, system.boottime, system.cpu.intr, system.cpu.load,
system.cpu.switches, system.hw.cpu, system.hw.macaddr, system.localtime, system.sw.os,
system.swap.in, system.swap.out, vfs.fs.discovery
Supported keys have the same parameters as Zabbix agent keys.
ZabbixStats Zabbix server/proxy internal metrics or number of delayed items in a queue. zabbix.stats Supported keys have the same parameters as Zabbix agent keys.
ZabbixSync Synchronous metrics collection. net.dns, net.dns.record, net.tcp.service, net.tcp.service.perf, proc.mem,
proc.num, system.hw.chassis, system.hw.devices, system.sw.packages,
system.users.num, vfs.dir.count, vfs.dir.size, vfs.fs.get, vfs.fs.inode,
vfs.fs.size, vm.memory.size.
Supported keys have the same parameters as Zabbix agent keys.