监控项原型对象
以下对象与 监控项原型 API 直接相关。
监控项原型
监控项原型对象具有以下属性。
| 属性 | 类型 | 描述 |
|---|---|---|
| itemid | ID | 监控项原型的 ID。 属性行为: - 只读 - 更新操作时为必需 |
| delay | string | 监控项原型的更新间隔。 接受秒数(例如 1、60、300)、带有时间后缀的值(例如 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}属性行为: - 当 type 设置为 "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) 时为必需;或者当 type 设置为 "Zabbix agent (active)" (7) 且 key_ 不包含 "mqtt.get" 时为必需 |
| hostid | ID | 监控项原型所属主机的 ID。 属性行为: - 常量 - 创建操作时为必需 |
| interfaceid | ID | 监控项原型的主机接口 ID。 属性行为: - 当监控项原型属于主机且 type 设置为 "Zabbix agent"、"IPMI agent"、"JMX agent"、"SNMP trap" 或 "SNMP agent" 时为必需- 当监控项原型属于主机且 type 设置为 "Simple check"、"External check"、"SSH agent"、"TELNET agent" 或 "HTTP agent" 时支持 |
| key_ | string | 监控项原型键。 属性行为: - 创建操作时为必需 - 对继承对象为只读 |
| name | string | 监控项原型的名称。 支持用户宏。 属性行为: - 创建操作时为必需 - 对继承对象为只读 |
| type | integer | 监控项原型的类型。 可能的值: 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。 属性行为: - 创建操作时为必需 - 对继承对象为只读 |
| url | string | URL 字符串。 支持 LLD 宏、用户宏、{HOST.IP}、{HOST.CONN}、{HOST.DNS}、{HOST.HOST}、{HOST.NAME}、{HOST.PORT}、{ITEM.ID}、{ITEM.KEY}。 属性行为: - 当 type 设置为 "HTTP agent" 时为必需- 对继承对象为只读 |
| value_type | integer | 监控项原型的信息类型。 可能的值: 0 - numeric float; 1 - character; 2 - log; 3 - numeric unsigned; 4 - text; 5 - binary; 6 - JSON。 属性行为: - 创建操作时为必需 - 对继承对象为只读 |
| allow_traps | integer | 允许以与 trapper 监控项类似的方式填充值。 0 - (默认) 不允许接受传入数据; 1 - 允许接受传入数据。 属性行为: - 当 type 设置为 "HTTP agent" 时支持 |
| authtype | integer | 身份验证方法。 当 type 设置为 "SSH agent" 时的可能值:0 - (默认) 密码; 1 - 公钥。 当 type 设置为 "HTTP agent" 时的可能值:0 - (默认) 无; 1 - basic; 2 - NTLM; 3 - Kerberos; 4 - Digest。 属性行为: - 当 type 设置为 "SSH agent" 或 "HTTP agent" 时支持- 对继承对象为只读(当 type 设置为 "HTTP agent" 时) |
| description | string | 监控项原型的描述。 |
| flags | integer | 监控项原型的来源。 可能的值: 2 - 监控项原型; 6 - 已发现的监控项原型 属性行为: - 只读 |
| follow_redirects | integer | 轮询数据时跟随响应重定向。 可能的值: 0 - 不跟随重定向; 1 - (默认) 跟随重定向。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| headers | array | 执行 HTTP 请求时发送的标头数组。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| history | string | 历史数据应存储多长时间的时间单位。 也接受用户宏和 LLD 宏。 默认值:31d。 |
| http_proxy | string | HTTP(S) proxy 连接字符串。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| ipmi_sensor | string | IPMI 传感器。 属性行为: - 当 type 设置为 "IPMI agent" 且 key_ 未设置为 "ipmi.get" 时为必需- 当 type 设置为 "IPMI agent" 时支持- 对继承对象为只读 |
| jmx_endpoint | string | JMX agent 自定义连接字符串。 默认值:service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi 属性行为: - 当 type 设置为 "JMX agent" 时支持 |
| logtimefmt | string | 日志条目中的时间格式。 属性行为: - 当 value_type 设置为 "log" 时支持- 对继承对象为只读 |
| master_itemid | ID | 主监控项的 ID。 属性行为: - 当 type 设置为 "Dependent item" 时为必需- 对继承对象为只读 |
| output_format | integer | 是否将响应转换为 JSON。 可能的值: 0 - (默认) 存储原始数据; 1 - 转换为 JSON。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| params | string | 根据监控项原型类型而定的其他参数: - SSH agent 和 TELNET agent 监控项原型要执行的脚本; - Database monitor 监控项原型的 SQL 查询; - Calculated 监控项原型的公式; - Script 和 Browser 监控项原型的脚本。 属性行为: - 当 type 设置为 "Database monitor"、"SSH agent"、"TELNET agent"、"Calculated"、"Script" 或 "Browser" 时为必需- 对继承对象为只读(当 type 设置为 "Script" 或 "Browser" 时) |
| parameters | object/array | 当 type 设置为 "Script" 或 "Browser" 时的其他参数。由包含 name 和 value 属性的对象组成的数组,其中 name 必须唯一。属性行为: - 当 type 设置为 "Script" 或 "Browser" 时支持- 对继承对象为只读 |
| password | string | 身份验证密码。 属性行为: - 当 type 设置为 "JMX agent" 且已设置 username 时为必需- 当 type 设置为 "Simple check"、"SSH agent"、"TELNET agent"、"Database monitor" 或 "HTTP agent" 时支持- 对继承对象为只读(当 type 设置为 "HTTP agent" 时) |
| post_type | integer | posts 属性中存储的 POST 数据正文类型。可能的值: 0 - (默认) 原始数据。 2 - JSON 数据。 3 - XML 数据。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| posts | string | HTTP(S) 请求正文数据。 属性行为: - 当 type 设置为 "HTTP agent" 且 post_type 设置为 "JSON data" 或 "XML data" 时为必需- 当 type 设置为 "HTTP agent" 且 post_type 设置为 "Raw data" 时支持- 对继承对象为只读 |
| privatekey | string | 私钥文件的名称。 属性行为: - 当 type 设置为 "SSH agent" 且 authtype 设置为 "public key" 时为必需 |
| publickey | string | 公钥文件的名称。 属性行为: - 当 type 设置为 "SSH agent" 且 authtype 设置为 "public key" 时为必需 |
| query_fields | array | 执行 HTTP 请求时发送的查询字段数组。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| request_method | integer | 请求方法类型。 可能的值: 0 - (默认) GET; 1 - POST; 2 - PUT; 3 - HEAD。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| retrieve_mode | integer | 应存储响应的哪一部分。 当 request_method 设置为 "GET"、"POST" 或 "PUT" 时的可能值:0 - (默认) 正文; 1 - 标头; 2 - 同时存储正文和标头。 当 request_method 设置为 "HEAD" 时的可能值:1 - 标头。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| snmp_oid | string | SNMP OID。 属性行为: - 当 type 设置为 "SNMP agent" 时为必需- 对继承对象为只读 |
| ssl_cert_file | string | 公共 SSL 密钥文件路径。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| ssl_key_file | string | 私有 SSL 密钥文件路径。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| ssl_key_password | string | SSL 密钥文件的密码。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| status | integer | 监控项原型的状态。 可能的值: 0 - (默认) 已启用的监控项原型; 1 - 已禁用的监控项原型; 3 - 不支持的监控项原型。 |
| status_codes | string | 必需的 HTTP 状态码范围,使用逗号分隔。 也支持在逗号分隔的列表中使用用户宏或 LLD 宏。 示例:200,200-{$M},{$M},200-400 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| templateid | ID | 父模板监控项原型的 ID。 属性行为: - 只读 |
| timeout | string | 监控项数据轮询请求超时。 接受秒数(例如 1、60、300)或带有时间后缀的值(例如 30s、1m)。也接受用户宏和 LLD 宏。可能的值范围:1-600s。 默认值:"" - 使用 proxy/全局设置。 属性行为: - 当 type 设置为 "Zabbix agent" (0)、"Simple check" (3) 且 key_ 不以 "vmware." 和 "icmpping" 开头,"Zabbix agent (active)" (7)、"External check" (10)、"Database monitor" (11)、"SSH agent" (13)、"TELNET agent" (14)、"HTTP agent" (19)、"SNMP agent" (20) 且 snmp_oid 以 "walk[" 或 "get[" 开头、"Script" (21)、"Browser" (22) 时支持- 对继承对象为只读 |
| trapper_hosts | string | 允许的主机。 属性行为: - 当 type 设置为 "Zabbix trapper" 时支持,或者当 type 设置为 "HTTP agent" 且 allow_traps 设置为 "Allow to accept incoming data" 时支持。如果省略该属性,则会自动将其设置为 {$TRAPPER.ALLOWED_HOSTS} 用户宏(默认值)。默认情况下,{$TRAPPER.ALLOWED_HOSTS} 为 127.0.0.1,::1。如果将该属性设置为空字符串,则将拒绝来自所有主机的传入连接。 |
| trends | string | 趋势数据应存储多长时间的时间单位。 也接受用户宏和 LLD 宏。 默认值:365d。 属性行为: - 当 value_type 设置为 "numeric float" 或 "numeric unsigned" 时支持 |
| units | string | 值单位。 属性行为: - 当 value_type 设置为 "numeric float" 或 "numeric unsigned" 时支持- 对继承对象为只读 |
| username | string | 身份验证用户名。 属性行为: - 当 type 设置为 "SSH agent" 或 "TELNET agent" 时,或者当 type 设置为 "JMX agent" 且已设置 password 时为必需- 当 type 设置为 "Simple check"、"Database monitor" 或 "HTTP agent" 时支持- 对继承对象为只读(当 type 设置为 "HTTP agent" 时) |
| uuid | string | 通用唯一标识符,用于将导入的监控项原型链接到已存在的监控项原型。如果未提供,则自动生成。 属性行为: - 当监控项原型属于模板时支持 |
| valuemapid | ID | 关联值映射的 ID。 属性行为: - 当 value_type 设置为 "numeric float"、"character" 或 "numeric unsigned" 时支持- 对继承对象为只读 |
| verify_host | integer | 是否验证连接的主机名是否与主机证书中的主机名匹配。 可能的值: 0 - (默认) 不验证; 1 - 验证。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| verify_peer | integer | 是否验证主机证书是否真实有效。 可能的值: 0 - (默认) 不验证; 1 - 验证。 属性行为: - 当 type 设置为 "HTTP agent" 时支持- 对继承对象为只读 |
| discover | integer | 监控项原型发现状态。 可能的值: 0 - (默认) 将发现新监控项; 1 - 不发现新监控项,并将现有监控项标记为已丢失。 |
HTTP 标头
header 对象具有以下属性:
HTTP 查询字段
查询字段对象定义了用于指定 URL 参数的名称和值。 它具有以下属性:
监控项原型标签
监控项原型标签对象具有以下属性。
| 属性 | Type | 描述 |
|---|---|---|
| tag | string | 监控项原型标签名称。 属性行为: - 必填 |
| value | string | 监控项原型标签值。 属性行为: - 只读。 |
| object | integer | 标签继承自的对象类型。 可能的值: 0 - 模板; 1 - 主机。 属性行为: - 只读。 |
| objectid | ID | 标签继承自的对象 ID。 属性行为: - 只读。 |
监控项原型预处理
监控项原型预处理对象具有以下属性。
| 属性 | 类型 | 描述 |
|---|---|---|
| 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 设置为“设置自定义值”或“设置自定义错误消息”时必需 |
以下参数和错误处理程序适用于每种预处理类型。
| 预处理类型 | 名称 | 参数 1 | 参数 2 | 参数 3 | 支持的错误处理程序 |
|---|---|---|---|---|---|
| 1 | 自定义倍数 | number1, 6 | 0, 1, 2, 3 | ||
| 2 | 右侧修剪 | 字符列表2 | |||
| 3 | 左侧修剪 | 字符列表2 | |||
| 4 | 修剪 | 字符列表2 | |||
| 5 | 正则表达式 | pattern3 | output2 | 0, 1, 2, 3 | |
| 6 | 布尔值转十进制 | 0, 1, 2, 3 | |||
| 7 | 八进制转十进制 | 0, 1, 2, 3 | |||
| 8 | 十六进制转十进制 | 0, 1, 2, 3 | |||
| 9 | 简单变化 | 0, 1, 2, 3 | |||
| 10 | 每秒变化 | 0, 1, 2, 3 | |||
| 11 | XML XPath | path4 | 0, 1, 2, 3 | ||
| 12 | JSONPath | path4 | 0, 1, 2, 3 | ||
| 13 | 范围检查 | min1, 6 | max1, 6 | 0, 1, 2, 3 | |
| 14 | 匹配正则表达式 | pattern3 | 0, 1, 2, 3 | ||
| 15 | 不匹配正则表达式 | pattern3 | 0, 1, 2, 3 | ||
| 16 | 检查 JSON 中的错误 | path4 | 0, 1, 2, 3 | ||
| 17 | 检查 XML 中的错误 | path4 | 0, 1, 2, 3 | ||
| 18 | 使用正则表达式检查错误 | pattern3 | output2 | 0, 1, 2, 3 | |
| 19 | 丢弃未更改的值 | ||||
| 20 | 使用心跳丢弃未更改的值 | seconds5, 6 | |||
| 21 | JavaScript | script2 | |||
| 22 | Prometheus 模式 | pattern6, 7 | value、label、function |
output8, 9 | 0, 1, 2, 3 |
| 23 | Prometheus 转 JSON | pattern6, 7 | 0, 1, 2, 3 | ||
| 24 | CSV 转 JSON | character2 | character2 | 0,1 | 0, 1, 2, 3 |
| 25 | 替换 | search string2 | replacement2 | ||
| 26 | 检查不支持 | scope1 | pattern3, 6 | 1, 2, 3 | |
| 27 | XML 转 JSON | 0, 1, 2, 3 | |||
| 28 | SNMP walk 值 | OID2 | 格式: 0 - 不变更 1 - 将 Hex-STRING 转换为 UTF-8 2 - 将 Hex-STRING 转换为 MAC 3 - 将 BITS 转换为整数 |
0, 1, 2, 3 | |
| 29 | SNMP walk 转 JSON10 | 字段名称2 | OID 前缀2 | 格式: 0 - 不变更 1 - 将 Hex-STRING 转换为 UTF-8 2 - 将 Hex-STRING 转换为 MAC 3 - 将 BITS 转换为整数 |
0, 1, 2, 3 |
| 30 | SNMP get 值 | 格式: 1 - 将 Hex-STRING 转换为 UTF-8 2 - 将 Hex-STRING 转换为 MAC 3 - 将 BITS 转换为整数 |
0, 1, 2, 3 | ||
1 整数或浮点数
2 字符串
3 正则表达式
4 JSONPath 或 XML XPath
5 正整数(支持时间后缀,例如 30s、1m、2h、1d)
6 用户宏、LLD 宏
7 遵循以下语法的 Prometheus 模式:<metric name>{<label name>="<label value>", ...} == <value>。每个 Prometheus 模式组件(指标、标签名称、标签值和指标值)都可以是用户宏或 LLD 宏。
8 当第二个参数选择 label 时,Prometheus 输出遵循以下语法:<label name>(可以是用户宏或 LLD 宏)。
9 当第二个参数选择 function 时,可以使用以下聚合函数之一:sum、min、max、avg、count。
10 支持多条“字段名称、OID 前缀、格式”记录,记录之间使用换行符分隔。