用户自定义宏可以用于以下场景: User-definable macros are supported in the following locations:
* 更新间隔
* SNMPv3 context 字段
* SNMPv3 security 字段
* SNMPv3 auth 密码
* SNMPv3 priv 密码
* SNMPv1/v2 团体串
* SNMP OID
* Discovery
* Update interval
* SNMPv3 context name
* SNMPv3 security name
* SNMPv3 auth pass
* SNMPv3 priv pass
* SNMPv1/v2 community
* SNMP OID
* 名称
* 更新间隔
* Agent
* HTTP proxy
* Variables
* Headers
* Step name
* Step URL
* Step post variables
* Step headers
* Step timeout
* Required string
* 必须的状态
* 认证 (用户名和密码)
* SSL certificate 文件
* SSL key 文件
* SSL key 密码
* Web scenario
* Name
* Update interval
* Agent
* HTTP proxy
* Variables
* Headers
* Step name
* Step URL
* Step post variables
* Step headers
* Step timeout
* Required string
* Required status codes
* Authentication (user and password)
* SSL certificate file
* SSL key file
* SSL key password
* Triggers
* 名称
* 表达式 (仅在常量和函数参数中)
* 描述信息
* URLs
* Name
* Expression (only in constants and function parameters)
* Description
* URLs
* 基于Trigger通知
* 基于Trigger内部通知
* 问题更新通知
* Trigger-based notifications
* Trigger-based internal notifications
* Problem update notifications
* 事件tags
* Tag 名称
* Tag 值
* Tag 匹配
* Event tags
* Tag name
* Tag value
* Tag for matching
* 默认步骤持续时间
* 步骤持续时间
* Action operations
* Default operation step duration
* Step duration
* 动作条件
* 时间周期条件
* Action conditions
* Time period condition
需要Zabbix所支持宏的完整列表, 请参考 支持宏列表。 For a complete list of all macros supported Zabbix, see macros supported by location.
In an item or an item prototype configuration, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Name (deprecated) | yes | |
Item key parameters | yes | |
Update interval | no | |
Custom intervals | no | |
History storage period | no | |
Trend storage period | no | |
Description | yes | |
Calculated item | ||
Formula | yes | |
Database monitor | ||
Username | yes | |
Password | yes | |
SQL query | yes | |
//HTTP agent // | ||
URL2 | yes | |
Query fields | yes | |
Timeout | no | |
Request body | yes | |
Headers (names and values) | yes | |
Required status codes | yes | |
HTTP proxy | yes | |
HTTP authentication username | yes | |
HTTP authentication password | yes | |
SSl certificate file | yes | |
SSl key file | yes | |
SSl key password | yes | |
Allowed hosts | yes | |
JMX agent | ||
JMX endpoint | yes | |
Script item | ||
Parameter names and values | yes | |
SNMP agent | ||
SNMP OID | yes | |
SSH agent | ||
Username | yes | |
Public key file | yes | |
Private key file | yes | |
Password | yes | |
Script | yes | |
TELNET agent | ||
Username | yes | |
Password | yes | |
Script | yes | |
Zabbix trapper | ||
Allowed hosts | yes | |
Tags | ||
Tag names | yes | |
Tag values | yes | |
Preprocessing | ||
Step parameters (including custom scripts) | yes |
In a low-level discovery rule, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Name | yes | |
Key parameters | yes | |
Update interval | no | |
Custom interval | no | |
Keep lost resources period | no | |
Description | yes | |
SNMP agent | ||
SNMP OID | yes | |
SSH agent | ||
Username | yes | |
Public key file | yes | |
Private key file | yes | |
Password | yes | |
Script | yes | |
TELNET agent | ||
Username | yes | |
Password | yes | |
Script | yes | |
Zabbix trapper | ||
Allowed hosts | yes | |
Database monitor | ||
Additional parameters | yes | |
JMX agent | ||
JMX endpoint | yes | |
HTTP agent | ||
URL2 | yes | |
Query fields | yes | |
Timeout | no | |
Request body | yes | |
Headers (names and values) | yes | |
Required status codes | yes | |
HTTP authentication username | yes | |
HTTP authentication password | yes | |
Filters | ||
Regular expression | yes | |
Overrides | ||
Filters: regular expression | yes | |
Operations: update interval (for item prototypes) | no | |
Operations: history storage period (for item prototypes) | no | |
Operations: trend storage period (for item prototypes) | no |
In a network discovery rule, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Update interval | no | |
SNMP v1, v2 | ||
SNMP community | yes | |
SNMP OID | yes | |
SNMP v3 | ||
Context name | yes | |
Security name | yes | |
Authentication passphrase | yes | |
Privacy passphrase | yes | |
SNMP OID | yes |
In a proxy configuration, user macros can be used in the following field:
Location | Multiple macros/mix with text1 | |
---|---|---|
Interface port (for passive proxy) | no |
In a template configuration, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
//Tags // | ||
Tag names | yes | |
Tag values | yes |
In a trigger configuration, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Name | yes | |
Operational data | yes | |
Expression (only in constants and function parameters; secret macros are not supported). | yes | |
Description | yes | |
URL2 | yes | |
Tag for matching | yes | |
Tags | ||
Tag names | yes | |
Tag values | yes |
In a web scenario configuration, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Name | yes | |
Update interval | no | |
Agent | yes | |
HTTP proxy | yes | |
Variables (values only) | yes | |
Headers (names and values) | yes | |
Steps | ||
Name | yes | |
URL2 | yes | |
Variables (values only) | yes | |
Headers (names and values) | yes | |
Timeout | no | |
Required string | yes | |
Required status codes | no | |
Authentication | ||
User | yes | |
Password | yes | |
SSL certificate | yes | |
SSL key file | yes | |
SSL key password | yes | |
Tags | ||
Tag names | yes | |
Tag values | yes |
In addition to the locations listed here, user macros can be used in the following fields:
Location | Multiple macros/mix with text1 | |
---|---|---|
Global scripts (script, SSH, Telnet, IPMI), including confirmation text | yes | |
Webhooks | ||
JavaScript script | no | |
JavaScript script parameter name | no | |
JavaScript script parameter value | yes | |
Monitoring → Dashboards | ||
URL2 field of dynamic URL dashboard widget | yes | |
Administration → Users → Media | ||
When active | no | |
Administration → General → GUI | ||
Working time | no | |
Administration → Media types → Message templates | ||
Subject | yes | |
Message | yes |
For a complete list of all macros supported in Zabbix, see supported macros.
1 If multiple macros in a field or macros mixed with text are not supported for the location, a single macro has to fill the whole field.
2 URLs that contain a secret macro will not work, as the macro in them will be resolved as "******".