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

> LLD 规则对象

下面的对象直接关联到discoveryrule(发现规则) API。

LLD 规则

低级发现规则对象有如下属性。

属性 类 说明
itemid string (只读) ID of the LLD rule. LLD规则的ID
delay
(必须)
string LLD规则的更新时间间隔。接受带后缀的秒或时间单位,包含或不包含一个或多个自定义时间间隔,它由灵活的时间间隔和调度时间间隔作为序列化字符串组成。也接受用户宏。灵活的间隔可以写成用正斜杠分隔的两个宏。间隔用分号分隔
hostid
(必须)
string LLD规则所属的Host的ID。
interfaceid
(必须)
string
LLD规则的主机接口ID。仅用于主机LLD规则。
Zabbix agent (active), Zabbix internal, Zabbix trapper and 数据库监控LLD规则的可选参数。
key_
(必须)
string LLD规则键。
name
(必须)
string LLD规则名称。
type
(必须)
integer
LLD规则类型。
可能的值:
0 - Zabbix agent;
1 - SNMPv1 agent;
2 - Zabbix trapper;
3 - simple check;
4 - SNMPv2 agent;
5 - Zabbix internal;
6 - SNMPv3 agent;
7 - Zabbix agent (active);
10 - external check;
11 - database monitor;
12 - IPMI agent;
13 - SSH agent;
14 - TELNET agent;
16 - JMX agent;
19 - HTTP agent;
19 -SNMP agent;
url
(必须)
string URL字符串,HTTP agent LLD rule要求有。支持用户宏, {HOST.IP}, {HOST.CONN}, {HOST.DNS}, {HOST.HOST}, {HOST.NAME}, {ITEM.ID}, {ITEM.KEY}。
allow_traps integer HTTP agent LLD规则字段。在陷阱监控项类型中也允许填充值

0 - (默认)不允许接受输入数据
1 - 允许输入数据
authtype integer 只能被SSH agent或HTTP agent使用
\\SSH agent认证方法可能的值:
0 - (默认) 密码;
1 - 公钥.

HTTP agent认证方法可能的值:
0 - (默认) none
1 - basic
2 - NTLM
description string LLD规则说明。
error string (只读) 如果更新LLD规则出问题时的错误文本。
follow_redirects integer HTTP agentLLD规则字段。当合并数据时进行重定向。

0 - 不跟随重定向。
1 - (默认)跟随重定向。
headers object HTTP agent LLD规则字段。该对象带有HTTP(S)已键为名称,包头的值作为值的请求头。

事例:
{ "User-Agent": "Zabbix" }
http_proxy string HTTP agent LLD规则字段。HTTP(S) proxy连接字符串。
ipmi_sensor string IPMI sensor.只用于IPMILLD规则
jmx_endpoint string JMX agent自定义连接字符串。

默认值:
service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi
lifetime string 不在发现的时间周期内监控项将被删除。接受秒、带后缀和用户宏的时间单位。

Default: 30d.
master_itemid integer 主条目ID。允许递归至多3个相关项,且相关项的最大计数为999。发现规则不能是其他发现规则的主项。相关项必需。
output_format integer HTTP agent LLD规则字段。应返回传递给JSON.

0 - (默认) Store raw.
1 - Convert to JSON.
params string 依赖于LLD规则类型的其他参数:
- 为SSH何Telnet LLD规则执行脚本;
- 数据库监控LLD规则的SQL查询;
- 计算类的LLD规则公式。
password string 认证密码。用于simple check, SSH, Telnet, database monitor, JMX and HTTP agent LLD 规则。
port string LLD规则使用的端口。仅SNMP LLD规则使用
post_type integer HTTP agent LLD 规则字段。post数据body部分存储在posts属性中的类型。

0 - (默认) Raw data.
2 - JSON data.
3 - XML data.
posts string HTTP agent LLD规则字段。HTTP(S)请求body数据,在post_type中使用。
privatekey string 私钥文件名。
publickey string 公共键文件的名称。
query_fields array HTTP agent LLD规则字段。查询参数。带有'key':'value' 键值对的数组对象,值可以为空。
request_method integer HTTP agent LLD规则字段。请求方法类型。

0 - GET
1 - (默认) POST
2 - PUT
3 - HEAD
retrieve_mode integer HTTP agent LLD规则字段。指明哪部分响应应被存储起来。

0 - (默认) Body.
1 - Headers.
2 - HTTP正文和HTTP Headers都将被存储.

对于http 请求方法头,只允许值为1。
snmp_oid string SNMP OID.
ssl_cert_file string HTTP agent LLD规则字段。公共SSL键文件路径。
ssl_key_file string HTTP agent LLD规则字段。私有SSL键文件路径。
ssl_key_password string HTTP agent LLD规则字段。SSL键文件密码。
state integer (只读) LLD规则的状态。

取值:
0 - (默认) 正常;
1 - 不支持
status integer Status of the LLD rule.

取值:
0 - (默认) 启用LLD规则;
1 - 关闭LLD规则.
status_codes string HTTP agent LLD规则字段。以逗号分隔的HTTP要求的状态码范围。

事例: 200,200-{$M},{$M},200-400
templateid string (只读)父模板LLD规则的ID。
timeout string HTTP agent LLD规则字段。Item数据轮训请求超时时间。支持用户宏。

默认: 3s
最大值: 60s
trapper_hosts string 允许的主机。用于trapper LLD规则或HTTP agent LLD规则。
username string 用户名进行身份验证。使用简单检查,SSH, Telnet,数据库监控,JMX和HTTP代理LLD规则。

SSH 和 Telnet LLD 规则要求。
verify_host integer HTTP agent LLD规则字段。URL中的主机名处于通用名称字段或主机证书的主题备用名称字段的合法性。

0 - (默认) 不验证.
1 - 验证.
verify_peer integer HTTP agent LLD规则字段。主机认证证书合法性。

0 - (默认) 不验证.
1 - 验证.

LLD 规则 过滤器

LLD规则筛选器对象定义一套能被用于过滤器发现对象的条件。它包含如下属性:

属性 类 说明
conditions
(必须)
array 用于过滤结果的过滤条件集。
evaltype
(必须)
integer
过滤条件评价方法。
取值:
0 - and/or;
1 - and;
2 - or;
3 - 自定义表达式.
eval_formula string (只读) 生成的表达式,将用于计算筛选器条件。表达式包含通过其“formulaid”引用特定筛选条件的id。“eval_formula”的值等于带有自定义表达式的过滤器的“formula”的值。
formula string 用户定义的表达式,用于使用自定义表达式计算过滤器的条件。表达式必须包含通过其“formulaid”引用特定筛选条件的id。表达式中使用的id必须与过滤器条件中定义的id完全匹配:任何条件都不能被使用或省略。

自定义表达式筛选器所需。

LLD rule 过滤器条件

LLD规则过滤器条件对象定义对LLD宏的值执行的单独检查:

属性 类 说明
macro
(必须)
string 对LLD宏执行检查。
value
(必须)
string 比较值
formulaid string 用于从自定义表达式引用条件的任意唯一ID。只能包含大写字母。在修改过滤条件时,ID必须由用户定义,但在请求之后,将重新生成ID。
operator integer 条件运算符.

取值:
8 - (默认) 匹配正则表达式;
9 - 不匹配正则表达式.

更好地理解如何使用各种类型的表达式的过滤器, 参见 发现规则.查看发现规则.创建 方法页面.

LLD macro path

The LLD macro path has the following properties:

Property Type Description
lld_macro
(required)
string LLD macro.
path
(required)
string Selector for value which will be assigned to corresponding macro.

LLD rule preprocessing

The LLD rule preprocessing object has the following properties.

Property Type Description
type
(required)
integer The preprocessing option type.

Possible values:
5 - Regular expression matching;
11 - XML XPath;
12 - JSONPath;
15 - Does not match regular expression;
16 - Check for error in JSON;
17 - Check for error in XML;
20 - Discard unchanged with heartbeat;
23 - Prometheus to JSON;
24 - CSV to JSON;
25 - Replace.
params
(required)
string Additional parameters used by preprocessing option. Multiple parameters are separated by LF (\n) character.
error_handler
(required)
integer Action type used in case of preprocessing step failure.

Possible values:
0 - Error message is set by Zabbix server;
1 - Discard value;
2 - Set custom value;
3 - Set custom error message.
error_handler_params
(required)
string Error handler parameters. Used with error_handler.

Must be empty, if error_handler is 0 or 1.
Can be empty if, error_handler is 2.
Cannot be empty, if error_handler is 3.

The following parameters and error handlers are supported for each preprocessing type.

Preprocessing type Name Parameter 1 Parameter 2 Parameter 3 Supported error handlers
5 Regular expression pattern1 output2 0, 1, 2, 3
11 XML XPath path3 0, 1, 2, 3
12 JSONPath path3 0, 1, 2, 3
15 Does not match regular expression pattern1 0, 1, 2, 3
16 Check for error in JSON path3 0, 1, 2, 3
17 Check for error in XML path3 0, 1, 2, 3
20 Discard unchanged with heartbeat seconds4, 5, 6
23 Prometheus to JSON pattern5, 7 0, 1, 2, 3
24 CSV to JSON character2 character2 0,1 0, 1, 2, 3
25 Replace search string2 replacement2

1 regular expression
2 string
3 JSONPath or XML XPath
4 positive integer (with support of time suffixes, e.g. 30s, 1m, 2h, 1d)
5 user macro
6 LLD macro
7 Prometheus pattern following the syntax: <metric name>{<label name>="<label value>", ...} == <value>. Each Prometheus pattern component (metric, label name, label value and metric value) can be user macro.
8 Prometheus output following the syntax: <label name>.

LLD rule overrides

The LLD rule overrides object defines a set of rules (filters, conditions and operations) that are used to override properties of different prototype objects. It has the following properties:

Property Type Description
name
(required)
string Unique override name.
step
(required)
integer Unique order number of the override.
stop integer Stop processing next overrides if matches.

Possible values:
0 - (default) don't stop processing overrides;
1 - stop processing overrides if filter matches.
filter object Override filter.
operations array Override operations.

LLD rule override filter

The LLD rule override filter object defines a set of conditions that if they match the discovered object the override is applied. It has the following properties:

Property Type Description
evaltype
(required)
integer Override filter condition evaluation method.

Possible values:
0 - and/or;
1 - and;
2 - or;
3 - custom expression.
conditions
(required)
array Set of override filter conditions to use for matching the discovered objects.
eval_formula string (readonly) Generated expression that will be used for evaluating override filter conditions. The expression contains IDs that reference specific override filter conditions by its formulaid. The value of eval_formula is equal to the value of formula for filters with a custom expression.
formula string User-defined expression to be used for evaluating conditions of override filters with a custom expression. The expression must contain IDs that reference specific override filter conditions by its formulaid. The IDs used in the expression must exactly match the ones defined in the override filter conditions: no condition can remain unused or omitted.

Required for custom expression override filters.

LLD rule override filter condition

The LLD rule override filter condition object defines a separate check to perform on the value of an LLD macro. It has the following properties:

Property Type Description
macro
(required)
string LLD macro to perform the check on.
value
(required)
string Value to compare with.
formulaid string Arbitrary unique ID that is used to reference the condition from a custom expression. Can only contain capital-case letters. The ID must be defined by the user when modifying filter conditions, but will be generated anew when requesting them afterward.
operator integer Condition operator.

Possible values:
8 - (default) matches regular expression;
9 - does not match regular expression.

LLD rule override operation

The LLD rule override operation is combination of conditions and actions to perform on the prototype object. It has the following properties:

Property Type Description
operationobject
(required)
integer Type of discovered object to perform the action.

Possible values:
0 - Item prototype;
1 - Trigger prototype;
2 - Graph prototype;
3 - Host prototype.
operator integer Override condition operator.

Possible values:
0 - (default) equals;
1 - does not equal;
2 - contains;
3 - does not contain;
8 - matches;
9 - does not match.
value string Pattern to match item, trigger, graph or host prototype name depending on selected object.
opstatus object Override operation status object for item, trigger and host prototype objects.
opdiscover object Override operation discover status object (all object types).
opperiod object Override operation period (update interval) object for item prototype object.
ophistory object Override operation history object for item prototype object.
optrends object Override operation trends object for item prototype object.
opseverity object Override operation severity object for trigger prototype object.
optag array Override operation tag object for trigger prototype object.
optemplate array Override operation template object for host prototype object.
opinventory object Override operation inventory object for host prototype object.
LLD rule override operation status

LLD rule override operation status that is set to discovered object. It has the following properties:

Property Type Description
status
(required)
integer Override the status for selected object.

Possible values:
0 - Create enabled;
1 - Create disabled.
LLD rule override operation discover

LLD rule override operation discover status that is set to discovered object. It has the following properties:

Property Type Description
discover
(required)
integer Override the discover status for selected object.

Possible values:
0 - Yes, continue discovering the objects;
1 - No, new objects will not be discovered and existing ones will me marked as lost.
LLD rule override operation period

LLD rule override operation period is an update interval value (supports custom intervals) that is set to discovered item. It has the following properties:

Property Type Description
delay
(required)
string Override the update interval of the item prototype. Accepts seconds or a time unit with suffix (30s,1m,2h,1d) as well as flexible and scheduling intervals and user macros or LLD macros. Multiple intervals are separated by a semicolon.
LLD rule override operation history

LLD rule override operation history value that is set to discovered item. It has the following properties:

Property Type Description
history
(required)
string Override the history of item prototype which is a time unit of how long the history data should be stored. Also accepts user macro and LLD macro.

LLD rule override operation trends value that is set to discovered item. It has the following properties:

Property Type Description
trends
(required)
string Override the trends of item prototype which is a time unit of how long the trends data should be stored. Also accepts user macro and LLD macro.
LLD rule override operation severity

LLD rule override operation severity value that is set to discovered trigger. It has the following properties:

Property Type Description
severity
(required)
integer Override the severity of trigger prototype.

Possible values are: 0 - (default) not classified;
1 - information;
2 - warning;
3 - average;
4 - high;
5 - disaster.
LLD rule override operation tag

LLD rule override operation tag object contains tag name and values that are set to discovered trigger. It has the following properties:

Property Type Description
tag
(required)
string Override the tag name of trigger prototype tags.
value string Override the tag value of trigger prototype tags.
LLD rule override operation template

LLD rule override operation template object that is linked to discovered host. It has the following properties:

Property Type Description
templateid
(required)
string Override the template of host prototype linked templates.
LLD rule override operation inventory

LLD rule override operation inventory mode value that is set to discovered host. It has the following properties:

Property Type Description
inventory_mode
(required)
integer Override the host prototype inventory mode.

Possible values are:
-1 - disabled;
0 - (default) manual;
1 - automatic.