Zabbix Documentation 3.4 (current)| In development:5.0 (devel)| Unsupported:

User Tools

Site Tools

This translation is older than the original page and might be outdated. See what has changed.



This is an old revision of the document!

3 自动发现(LLD)


Low-level discovery provides a way to automatically create items, triggers, and graphs for different entities on a computer. For instance, Zabbix can automatically start monitoring file systems or network interfaces on your machine, without the need to create items for each file system or network interface manually. Additionally it is possible to configure Zabbix to remove unneeded entities automatically based on actual results of periodically performed discovery.


In Zabbix, six types of discovery items are supported out of the box:


  • discovery of file systems;
  • 系统文件的发现;
  • discovery of network interfaces;
  • 网络接口的发现;
  • discovery of CPUs and CPU cores;
  • CPU和CPU内核的发现
  • discovery of SNMP OIDs;
  • SNMP OID的发现
  • discovery using ODBC SQL queries;
  • 使用ODBC SQL查询的发现
  • discovery of Windows services.
  • Windows服务的发现

A user can define their own types of discovery, provided they follow a particular JSON protocol.


The general architecture of the discovery process is as follows.


First, a user creates a discovery rule in “Configuration” → “Templates” → “Discovery” column. A discovery rule consists of (1) an item that discovers the necessary entities (for instance, file systems or network interfaces) and (2) prototypes of items, triggers, and graphs that should be created based on the value of that item.


An item that discovers the necessary entities is like a regular item seen elsewhere: the server asks a Zabbix agent (or whatever the type of the item is set to) for a value of that item, the agent responds with a textual value. The difference is that the value the agent responds with should contain a list of discovered entities in a specific JSON format. While the details of this format are only important for implementers of custom discovery checks, it is necessary to know that the returned value contains a list of macro → value pairs. For instance, item “net.if.discovery” might return two pairs: “{#IFNAME}” → “lo” and “{#IFNAME}” → “eth0”.

发现必要实体的项目就像其他地方所看到的常规项目:服务器向该项目的值询问Zabbix agent(或者该项目的任何类型的设置),agent以文本值进行响应。区别在于agent响应的值应该包含特定JSON格式的发现实体的列表。这种格式的自定义检查者发现的细节才是最重要的,因为返回值必须包含宏→值对。例如,项目“net.if.discovery”可能会返回两对键值:“{#IFNAME}”→“lo”和“{#IFNAME}”→“eth0”。

Low-level discovery items “vfs.fs.discovery” and “net.if.discovery” are supported since Zabbix agent version 2.0.
Discovery item “system.cpu.discovery” is supported since Zabbix agent version 2.4.
Discovery of SNMP OIDs is supported since Zabbix server and proxy version 2.0.
Discovery using ODBC SQL queries is supported since Zabbix server and proxy version 3.0.
Zabbix agent版本2.0支持自动发现项目“vfs.fs.discovery”和“net.if.discovery”。
从Zabbix agent版本2.4起支持发现项目“system.cpu.discovery”。
从Zabbix server和proxy版本2.0起支持发现SNMP OID。
从Zabbix server和proxy版本3.0起支持使用ODBC SQL查询的发现。
Return values of a low-level discovery rule are limited to 2048 bytes on a Zabbix proxy run with IBM DB2 database. This limit does not apply to Zabbix server as return values are processed without being stored in a database.
在使用IBM DB2数据库运行的Zabbix proxy上,自动发现规则的返回值限制为2048字节。此限制不适用于Zabbix server,因为返回值不会被存储在数据库中。

These macros are used in names, keys and other prototype fields where they are then substituted with the received values for creating real items, triggers, graphs or even hosts for each discovered entity. See the full list of options for using LLD macros.


When the server receives a value for a discovery item, it looks at the macro → value pairs and for each pair generates real items, triggers, and graphs, based on their prototypes. In the example with “net.if.discovery” above, the server would generate one set of items, triggers, and graphs for the loopback interface “lo”, and another set for interface “eth0”.


The following sections illustrate the process described above in detail and serve as a how-to for performing all types of discovery mentioned above. The last section describes the JSON format for discovery items and gives an example of how to implement your own file system discoverer as a Perl script.


3.1 文件系统的发现

To configure the discovery of file systems, do the following:


  • Go to: ConfigurationTemplates
  • 转到:配置 → 模板
  • Click on Discovery in the row of an appropriate template
  • 在一个合适的模板的行点击发现

  • Click on Create discovery rule in the upper right corner of the screen
  • 单击屏幕右上角的创建发现规则
  • Fill in the form with the following details
  • 填写以下详细信息。

The Discovery rule tab contains general discovery rule attributes:


名称 发现规则名称。
类型 The type of check to perform discovery; should be Zabbix agent or Zabbix agent (active) for file system discovery.