监控项 原型 object
以下 objects 与 itemprototype API 直接相关。
监控项原型
监控项原型对象具有以下属性。
| Property | Type | Description |
|---|---|---|
| itemid | ID | 监控项原型的 ID。 Property behavior: - read-only - required for update operations |
| delay | string | 监控项原型的更新间隔。 接受秒数或带后缀的时间单位(例如 30s、1m、2h、1d),并且可选地接受一个或多个 自定义间隔,所有项以分号分隔。自定义间隔可以是灵活间隔和计划间隔的混合。 接受用户宏和 LLD 宏。如果使用,值必须是单个宏。不支持多个宏或宏与文本混合。灵活间隔可以写成由斜杠分隔的两个宏(例如 {$FLEX_INTERVAL}/{$FLEX_PERIOD})。示例: 1h;wd1-5h9-18;{$Macro1}/1-7,00:00-24:00;0/6-7,12:00-24:00;{$Macro2}/{$Macro3}Property behavior: - required if type is set to "Zabbix agent" (0), "Simple check" (3), "Zabbix internal" (5), "External check" (10), "Database monitor" (11), "IPMI agent" (12), "SSH agent" (13), "TELNET agent" (14), "Calculated" (15), "JMX agent" (16), "HTTP agent" (19), "SNMP agent" (20), "Script" (21), "Browser" (22), or if type is set to "Zabbix agent (active)" (7) and key_ does not contain "mqtt.get" |
| hostid | ID | 监控项原型所属主机的 ID。 Property behavior: - constant - required for create operations |
| interfaceid | ID | 监控项原型所属主机接口的 ID。 Property behavior: - required if item prototype belongs to host and type is set to "Zabbix agent", "IPMI agent", "JMX agent", "SNMP trap", or "SNMP agent"- supported if item prototype belongs to host and type is set to "Simple check", "External check", "SSH agent", "TELNET agent", or "HTTP agent" |
| key_ | string | 监控项原型键值。 Property behavior: - required for create operations - read-only for inherited objects |
| name | string | 监控项原型名称。 支持用户宏。 Property behavior: - required for create operations - read-only for inherited objects |
| type | integer | 监控项原型的类型。 Possible values: 0 - Zabbix agent; 2 - Zabbix trapper; 3 - Simple check; 5 - Zabbix internal; 7 - Zabbix agent (active); 10 - External check; 11 - Database monitor; 12 - IPMI agent; 13 - SSH agent; 14 - TELNET agent; 15 - Calculated; 16 - JMX agent; 17 - SNMP trap; 18 - Dependent item; 19 - HTTP agent; 20 - SNMP agent; 21 - Script; 22 - Browser. Property behavior: - required for create operations - read-only for inherited objects |
| url | string | URL 字符串。 支持 LLD 宏、用户宏、{HOST.IP}、{HOST.CONN}、{HOST.DNS}、{HOST.HOST}、{HOST.NAME}、{ITEM.ID}、{ITEM.KEY}。 Property behavior: - required if type is set to "HTTP agent"- read-only for inherited objects |
| value_type | integer | 监控项原型的信息类型。 Possible values: 0 - numeric float; 1 - character; 2 - log; 3 - numeric unsigned; 4 - text; 5 - binary. Property behavior: - required for create operations - read-only for inherited objects |
| allow_traps | integer | 允许像 trapper 监控项一样填充值。 0 - (default) 不允许接收传入数据; 1 - 允许接收传入数据。 Property behavior: - supported if type is set to "HTTP agent" |
| authtype | integer | 认证方式。 Possible values if type is set to "SSH agent":0 - (default) password; 1 - public key. Possible values if type is set to "HTTP agent":0 - (default) none; 1 - basic; 2 - NTLM; 3 - Kerberos; 4 - Digest. Property behavior: - supported if type is set to "SSH agent" or "HTTP agent"- read-only for inherited objects (if type is set to "HTTP agent") |
| description | string | 监控项原型的描述。 |
| follow_redirects | integer | 轮询数据时是否跟随响应重定向。 Possible values: 0 - Do not follow redirects; 1 - (default) Follow redirects. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| headers | array | 执行 HTTP 请求时发送的 headers 数组。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| history | string | 历史数据的保存时长。 也接受用户宏和 LLD 宏。 默认值:31d。 |
| http_proxy | string | HTTP(S) proxy 连接字符串。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| ipmi_sensor | string | IPMI 传感器。 Property behavior: - required if type is set to "IPMI agent" and key_ is not set to "ipmi.get"- supported if type is set to "IPMI agent"- read-only for inherited objects |
| jmx_endpoint | string | JMX agent 自定义连接字符串。 默认值:service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi Property behavior: - supported if type is set to "JMX agent" |
| logtimefmt | string | 日志条目中的时间格式。 Property behavior: - supported if value_type is set to "log"- read-only for inherited objects |
| master_itemid | ID | 主监控项的 ID。 允许最多递归 3 层的依赖监控项和监控项原型,且依赖监控项和监控项原型的最大总数为 29999。 Property behavior: - required if type is set to "Dependent item"- read-only for inherited objects |
| output_format | integer | 是否将响应转换为 JSON。 Possible values: 0 - (default) Store raw; 1 - Convert to JSON. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| params | string | 根据监控项原型类型而定的附加参数: - SSH agent 和 TELNET agent 监控项原型执行的脚本; - database monitor 监控项原型的 SQL 查询; - calculated 监控项原型的公式; - script 和 browser 监控项原型的脚本。 Property behavior: - required if type is set to "Database monitor", "SSH agent", "TELNET agent", "Calculated", "Script", or "Browser"- read-only for inherited objects (if type is set to "Script" or "Browser") |
| parameters | object/array | 如果 type 设置为 "Script" 或 "Browser",则为附加参数。由包含 name 和 value 属性的对象数组组成,其中 name 必须唯一。Property behavior: - supported if type is set to "Script" or "Browser"- read-only for inherited objects |
| password | string | 认证密码。 Property behavior: - required if type is set to "JMX agent" and username is set- supported if type is set to "Simple check", "SSH agent", "TELNET agent", "Database monitor", or "HTTP agent"- read-only for inherited objects (if type is set to "HTTP agent") |
| post_type | integer | 存储在 posts 属性中的 POST 数据体类型。Possible values: 0 - (default) Raw data. 2 - JSON data. 3 - XML data. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| posts | string | HTTP(S) 请求体数据。 Property behavior: - required if type is set to "HTTP agent" and post_type is set to "JSON data" or "XML data"- supported if type is set to "HTTP agent" and post_type is set to "Raw data"- read-only for inherited objects |
| privatekey | string | 私钥文件名。 Property behavior: - required if type is set to "SSH agent" and authtype is set to "public key" |
| publickey | string | 公钥文件名。 Property behavior: - required if type is set to "SSH agent" and authtype is set to "public key" |
| query_fields | array | 执行 HTTP 请求时发送的 query fields 数组。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| request_method | integer | 请求方法类型。 Possible values: 0 - (default) GET; 1 - POST; 2 - PUT; 3 - HEAD. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| retrieve_mode | integer | 应存储响应的哪一部分。 Possible values if request_method is set to "GET", "POST", or "PUT":0 - (default) Body; 1 - Headers; 2 - Both body and headers will be stored. Possible values if request_method is set to "HEAD":1 - Headers. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| snmp_oid | string | SNMP OID。 Property behavior: - required if type is set to "SNMP agent"- read-only for inherited objects |
| ssl_cert_file | string | 公有 SSL 密钥文件路径。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| ssl_key_file | string | 私有 SSL 密钥文件路径。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| ssl_key_password | string | SSL 密钥文件密码。 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| status | integer | 监控项原型的状态。 Possible values: 0 - (default) enabled item prototype; 1 - disabled item prototype; 3 - unsupported item prototype. |
| status_codes | string | 以逗号分隔的所需 HTTP 状态码范围。 也支持将用户宏或 LLD 宏作为逗号分隔列表的一部分。 示例:200,200-{$M},{$M},200-400 Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| templateid | ID | 父模板监控项原型的 ID。 Property behavior: - read-only |
| timeout | string | 监控项数据轮询请求的超时时间。 接受秒数或带后缀的时间单位(例如 30s、1m)。也接受用户宏和 LLD 宏。 Possible values range: 1-600s. 默认值:"" - 使用 proxy/全局设置。 Property behavior: - supported if type is set to "Zabbix agent" (0), "Simple check" (3) and key_ does not start with "vmware." and "icmpping", "Zabbix agent (active)" (7), "External check" (10), "Database monitor" (11), "SSH agent" (13), "TELNET agent" (14), "HTTP agent" (19), "SNMP agent" (20) and snmp_oid starts with "walk[" or "get[", "Script" (21), "Browser" (22)- read-only for inherited objects |
| trapper_hosts | string | 允许的主机。 Property behavior: - supported if type is set to "Zabbix trapper", or if type is set to "HTTP agent" and allow_traps is set to "Allow to accept incoming data" |
| trends | string | 趋势数据的保存时长。 也接受用户宏和 LLD 宏。 默认值:365d。 Property behavior: - supported if value_type is set to "numeric float" or "numeric unsigned" |
| units | string | 值单位。 Property behavior: - supported if value_type is set to "numeric float" or "numeric unsigned"- read-only for inherited objects |
| username | string | 认证用户名。 Property behavior: - required if type is set to "SSH agent" or "TELNET agent", or if type is set to "JMX agent" and password is set- supported if type is set to "Simple check", "Database monitor", or "HTTP agent"- read-only for inherited objects (if type is set to "HTTP agent") |
| uuid | string | 通用唯一标识符,用于将导入的监控项原型链接到已存在的对象。如果未提供,则自动生成。 Property behavior: - supported if the item prototype belongs to a template |
| valuemapid | ID | 关联值映射的 ID。 Property behavior: - supported if value_type is set to "numeric float", "character", or "numeric unsigned"- read-only for inherited objects |
| verify_host | integer | 是否验证连接的主机名与主机证书中的名称一致。 Possible values: 0 - (default) Do not validate; 1 - Validate. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| verify_peer | integer | 是否验证主机证书是否可信。 Possible values: 0 - (default) Do not validate; 1 - Validate. Property behavior: - supported if type is set to "HTTP agent"- read-only for inherited objects |
| discover | integer | 监控项原型发现状态。 Possible values: 0 - (default) new items will be discovered; 1 - new items will not be discovered and existing items will be marked as lost. |
HTTP 标头
标头对象具有以下属性:
| Property | Type | Description |
|---|---|---|
| name | string | HTTP 标头名称。 Property behavior: - required |
| value | string | 标头值。 Property behavior: - required |
HTTP 查询字段
查询字段对象定义了一个名称和值,用于指定 URL 参数。 它具有以下属性:
| Property | Type | Description |
|---|---|---|
| name | string | 参数名称。 Property behavior: - required |
| value | string | 参数值。 Property behavior: - required |
监控项原型标签
监控项原型标签对象具有以下属性。
监控项原型预处理
监控项原型预处理对象具有以下属性。
| Property | Type | Description |
|---|---|---|
| type | integer | 预处理选项类型。 可能的值: 1 - 自定义倍数; 2 - 右侧裁剪; 3 - 左侧裁剪; 4 - 裁剪; 5 - 正则表达式; 6 - 布尔值转十进制; 7 - 八进制转十进制; 8 - 十六进制转十进制; 9 - 简单变更; 10 - 每秒变更; 11 - XML XPath; 12 - JSONPath; 13 - 范围内; 14 - 匹配正则表达式; 15 - 不匹配正则表达式; 16 - 检查 JSON 中的错误; 17 - 检查 XML 中的错误; 18 - 使用正则表达式检查错误; 19 - 丢弃未变化值; 20 - 带心跳的丢弃未变化值; 21 - JavaScript; 22 - Prometheus 模式; 23 - Prometheus 转 JSON; 24 - CSV 转 JSON; 25 - 替换; 26 - 检查不受支持; 27 - XML 转 JSON; 28 - SNMP walk 值; 29 - SNMP walk 转 JSON; 30 - SNMP get 值。 属性行为: - 必填 |
| params | string | 预处理选项使用的附加参数。 多个参数之间使用换行符 (\n) 分隔。 如果 type 设置为“检查不受支持”,参数采用 <scope>[\n<pattern>] 语法,其中 pattern 为正则表达式,scope 为以下之一:-1 - 匹配任意错误; \ 0 - 检查错误消息是否匹配 pattern; \ 1 - 检查错误消息是否不匹配 pattern。 属性行为: - 当 type 设置为“自定义倍数”(1)、“右侧裁剪”(2)、“左侧裁剪”(3)、“裁剪”(4)、“正则表达式”(5)、“XML XPath”(11)、“JSONPath”(12)、“范围内”(13)、“匹配正则表达式”(14)、“不匹配正则表达式”(15)、“检查 JSON 中的错误”(16)、“检查 XML 中的错误”(17)、“使用正则表达式检查错误”(18)、“带心跳的丢弃未变化值”(20)、“JavaScript”(21)、“Prometheus 模式”(22)、“Prometheus 转 JSON”(23)、“CSV 转 JSON”(24)、“替换”(25)、“检查不受支持”(26)、“SNMP walk 值”(28)、“SNMP walk 转 JSON”(29) 或 “SNMP get 值”(30) 时,必填 |
| error_handler | integer | 预处理步骤失败时使用的动作类型。 可能的值: 0 - 错误消息由 Zabbix 服务器设置; 1 - 丢弃值; 2 - 设置自定义值; 3 - 设置自定义错误消息。 如果 type 设置为“检查不受支持”,可能的值为:1 - 丢弃值; 2 - 设置自定义值; 3 - 设置自定义错误消息。 属性行为: - 当 type 设置为“自定义倍数”(1)、“正则表达式”(5)、“布尔值转十进制”(6)、“八进制转十进制”(7)、“十六进制转十进制”(8)、“简单变更”(9)、“每秒变更”(10)、“XML XPath”(11)、“JSONPath”(12)、“范围内”(13)、“匹配正则表达式”(14)、“不匹配正则表达式”(15)、“检查 JSON 中的错误”(16)、“检查 XML 中的错误”(17)、“使用正则表达式检查错误”(18)、“Prometheus 模式”(22)、“Prometheus 转 JSON”(23)、“CSV 转 JSON”(24)、“检查不受支持”(26)、“XML 转 JSON”(27)、“SNMP walk 值”(28)、“SNMP walk 转 JSON”(29) 或 “SNMP get 值”(30) 时,必填 |
| error_handler_params | string | 错误处理器参数。 属性行为: - 当 error_handler 设置为“设置自定义值”或“设置自定义错误消息”时,必填 |
以下参数和错误处理器适用于每种预处理类型。
| Preprocessing type | Name | Parameter 1 | Parameter 2 | Parameter 3 | Supported error handlers |
|---|---|---|---|---|---|
| 1 | Custom multiplier | number1, 6 | 0, 1, 2, 3 | ||
| 2 | Right trim | list of characters2 | |||
| 3 | Left trim | list of characters2 | |||
| 4 | Trim | list of characters2 | |||
| 5 | Regular expression | pattern3 | output2 | 0, 1, 2, 3 | |
| 6 | Boolean to decimal | 0, 1, 2, 3 | |||
| 7 | Octal to decimal | 0, 1, 2, 3 | |||
| 8 | Hexadecimal to decimal | 0, 1, 2, 3 | |||
| 9 | Simple change | 0, 1, 2, 3 | |||
| 10 | Change per second | 0, 1, 2, 3 | |||
| 11 | XML XPath | path4 | 0, 1, 2, 3 | ||
| 12 | JSONPath | path4 | 0, 1, 2, 3 | ||
| 13 | In range | min1, 6 | max1, 6 | 0, 1, 2, 3 | |
| 14 | Matches regular expression | pattern3 | 0, 1, 2, 3 | ||
| 15 | Does not match regular expression | pattern3 | 0, 1, 2, 3 | ||
| 16 | Check for error in JSON | path4 | 0, 1, 2, 3 | ||
| 17 | Check for error in XML | path4 | 0, 1, 2, 3 | ||
| 18 | Check for error using regular expression | pattern3 | output2 | 0, 1, 2, 3 | |
| 19 | Discard unchanged | ||||
| 20 | Discard unchanged with heartbeat | seconds5, 6 | |||
| 21 | JavaScript | script2 | |||
| 22 | Prometheus pattern | pattern6, 7 | value, label, function |
output8, 9 | 0, 1, 2, 3 |
| 23 | Prometheus to JSON | pattern6, 7 | 0, 1, 2, 3 | ||
| 24 | CSV to JSON | character2 | character2 | 0,1 | 0, 1, 2, 3 |
| 25 | Replace | search string2 | replacement2 | ||
| 26 | Check unsupported | scope1 | pattern3, 6 | 1, 2, 3 | |
| 27 | XML to JSON | 0, 1, 2, 3 | |||
| 28 | SNMP walk value | OID2 | Format: 0 - Unchanged 1 - UTF-8 from Hex-STRING 2 - MAC from Hex-STRING 3 - Integer from BITS |
0, 1, 2, 3 | |
| 29 | SNMP walk to JSON10 | Field name2 | OID prefix2 | Format: 0 - Unchanged 1 - UTF-8 from Hex-STRING 2 - MAC from Hex-STRING 3 - Integer from BITS |
0, 1, 2, 3 |
| 30 | SNMP get value | Format: 1 - UTF-8 from Hex-STRING 2 - MAC from Hex-STRING 3 - Integer from BITS |
0, 1, 2, 3 | ||
1 integer or floating-point number
2 string
3 regular expression
4 JSONPath or XML XPath
5 positive integer (with support of time suffixes, e.g. 30s, 1m, 2h,
1d)
6 user macro, 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 or LLD macro.
8 Prometheus output following the syntax: <label name> (can be a user macro or an LLD macro) if label is selected as the
second parameter.
9 One of the aggregation functions: sum, min, max, avg, count if function is selected as the second
parameter.
10 Supports multiple "Field name,OID prefix,Format records" records delimited by a new line character.