Zabbix Documentation 3.4

3.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.22.43.23.4

User Tools

Site Tools

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

Sidebar

zh:manual:discovery:low_level_discovery

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.

自动发现(LLD)提供了一种在计算机上为不同实体自动创建监控项,触发器和图形的方法。例如,Zabbix可以在你的机器上自动开始监控文件系统或网络接口,而无需为每个文件系统或网络接口手动创建监控项。此外,可以配置Zabbix根据定期执行发现后的得到实际结果,来移除不需要的监控项。

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

在Zabbix中,支持六种类型的发现项目:

  • 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.

用户可以自己定义发现类型,只要它们遵循特定的JSON协议。

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.

首先,用户在“配置”→“模板”→“发现”列中创建一个发现规则。发现规则包括(1)发现必要实体(例如,文件系统或网络接口)的项目和(2)应该根据该项目的值创建的监控项,触发器和图形的原型

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.

这些宏用于名称,键值和其他原型字段中,然后用接收到的值为每个发现的实体创建实际的监控项,触发器,图形甚至主机。请参阅使用LLD宏的选项的完整列表。

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”.

当服务器接收到发现项目的值时,它会查看宏→值对,每对都根据原型生成实际监控项,触发器和图形。在上面的“net.if.discovery”示例中,服务器将生成环路接口“lo”的一组监控项,触发器和图表,另一组用于界面“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.

以下部分将详细说明上述过程,并作为一个指导上述类型的所有发现。最后一节描述了发现项目的JSON格式,并给出了文件系统发现实现的Perl脚本的示例。

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.
类型