文档
测试

获取监控项

POST
api_jsonrpc.php

请求头

参数名
类型
描述
必填
Content-Type
String
请求的 Content-Type 头部必须设置为以下值之一: application/json-rpc, application/json 或 application/jsonrequest
必填

请求参数

参数名
类型
描述
必填
jsonrpc
String
API使用的JSON-RPC协议的版本; API实现JSON-RPC版本2.0;
必填
method
String
调用的API方法; item.get
必填
params
JSON
请求传递参数
必填
output
String
定义所需输出的参数
必填
hostids
String
主机ID
必填
search
JSON
检索参数
必填
key_
String
key of the item prototype 监控项key
必填
sortfield
String
必填
id
String
请求的任意标识符;
必填
auth
String
用户认证令牌;
必填

响应参数

参数名
类型
描述
必填
jsonrpc
string
示例:2.0 JSON-RPC协议的版本;
必填
result
array
数据列表 方法返回的数据;
必填
itemid
string
示例:23298 监控项ID
必填
type
string
示例:0 Type of the item. item的类别 Possible values:可能的值: 0 - agent; 1 - SNMPv1 agent; 2 - trapper; 3 - simple check; 4 - SNMPv2 agent; 5 - internal; 6 - SNMPv3 agent; 7 - agent (active); 8 - aggregate; 9 - web item; 10 - external check; 11 - database monitor; 12 - IPMI agent; 13 - SSH agent; 14 - TELNET agent; 15 - calculated; 16 - JMX agent; 17 - SNMP trap.
必填
snmp_community
string
示例: SNMP community. Used only by SNMPv1 and SNMPv2 items. SNMP社区。 仅由SNMPv1和SNMPv2项使用。
必填
snmp_oid
string
示例: SNMP OID.
必填
hostid
string
示例:10084 该项所属的主机 ID。
必填
name
string
示例:Context switches per second Name of the item. item的名称
必填
key_
string
示例:system.cpu.switches Item key.
必填
delay
string
示例:1m 更新监控项的间隔。 接受具有后缀的秒或时间单位,并且具有或不具有由灵活间隔和调度间隔组成的一个或多个自定义间隔作为串行化字符串。也接受用户宏。 灵活的间隔可以写成两个由正斜杠分隔的宏。 间隔用分号分隔。
必填
history
string
示例:7d A time unit of how long the history data should be stored. Also accepts user macro. 历史数据应该存储多长时间的单位。 也接受用户宏。 Default: 90d.
必填
trends
string
示例:365d A time unit of how long the trends data should be stored. Also accepts user macro.趋势数据应存储多长时间的单位。 也接受用户宏。 Default: 365d.
必填
lastvalue
string
示例:2552 (readonly) Last value of the item. item的最后一个值。 This property will only return a value for the period configured in ZBX_HISTORY_PERIOD. 此属性将仅返回ZBX_HISTORY_PERIOD中配置的时间段的值
必填
lastclock
string
示例:1351090998 (readonly) Time when the item was last updated. item上次更新时间。 This property will only return a value for the period configured in ZBX_HISTORY_PERIOD. 此属性将仅返回ZBX_HISTORY_PERIOD中配置的时间段的值
必填
prevvalue
string
示例:2641 (readonly) Previous value of the item. item的上一个值。 This property will only return a value for the period configured in ZBX_HISTORY_PERIOD.此属性将仅返回ZBX_HISTORY_PERIOD中配置的时间段的值
必填
state
string
示例:0 (readonly) State of the item. item状态。 Possible values: 可能的值: 0 - (default) normal; 1 - not supported.
必填
status
string
示例:0 Status of the item. item状态 Possible values: 可能的值: 0 - (default) enabled item; 1 - disabled item.
必填
value_type
string
示例:3 Type of information of the item. item的信息类型。 Possible values:可能的值: 0 - numeric float; 1 - character; 2 - log; 3 - numeric unsigned; 4 - text.
必填
trapper_hosts
string
示例: Allowed hosts. Used only by trapper items.允许的主机。 仅由trapper items使用。
必填
units
string
示例:sps Value units.
必填
multiplier
string
示例:0 Whether to use a custom multiplier.是否使用自定义乘数。
必填
delta
string
示例:1 Value that will be stored. 将被存储的值 Possible values:可能的值: 0 - (default) as is; 1 - Delta, speed per second; 2 - Delta, simple change.
必填
snmpv3_securityname
string
示例: SNMPv3 security name. Used only by SNMPv3 items. SNMPv3安全名称。 仅用于SNMPv3项
必填
snmpv3_securitylevel
string
示例:0 SNMPv3 security level. Used only by SNMPv3 items.SNMPv3安全级别。 仅用于SNMPv3项 Possible values:可能的值: 0 - noAuthNoPriv; 1 - authNoPriv; 2 - authPriv.
必填
snmpv3_authpassphrase
string
示例: SNMPv3 auth passphrase. Used only by SNMPv3 items. 仅用于SNMPv3项。
必填
snmpv3_privpassphrase
string
示例: SNMPv3 priv passphrase. Used only by SNMPv3 items. SNMPv3 priv密码。 仅用于SNMPv3项
必填
snmpv3_authprotocol
string
示例:0 SNMPv3 authentication protocol. Used only by SNMPv3 items. SNMPv3认证协议 仅用于SNMPv3项。 Possible values:可能的值 0 - (default) MD5; 1 - SHA.
必填
snmpv3_privprotocol
string
示例:0 SNMPv3 privacy protocol. Used only by SNMPv3 items. SNMPv3隐私协议。 仅用于SNMPv3项 Possible values:可能的值: 0 - (default) DES; 1 - AES.
必填
snmpv3_contextname
string
示例: SNMPv3 context name. Used only by SNMPv3 items. SNMPv3上下文名称。 仅用于SNMPv3项
必填
formula
string
示例:1 Custom multiplier. Default: 1.
必填
error
string
示例: readonly) Error text if there are problems updating the item.如果更新项目时出现问题,则显示错误文本。
必填
lastlogsize
string
示例:0
必填
logtimefmt
string
示例: Format of the time in log entries. Used only by log items.日志条目中的时间格式。 仅用于日志项。
必填
templateid
string
示例:22680 (readonly) ID of the parent template item. 父模板项的ID。
必填
valuemapid
string
示例:0 ID of the associated value map.相关值图的ID。
必填
params
string
示例: Additional parameters depending on the type of the item: 附加参数取决于item的类型: - executed script for SSH and Telnet items;SSH和Telnet items执行脚本; - SQL query for database monitor items; SQL查询数据库监视项 - formula for calculated items.计算项公式
必填
ipmi_sensor
string
示例: IPMI sensor. Used only by IPMI items. IPMI传感器 仅由IPMI项使用。
必填
data_type
string
示例:0 Data type of the item. item的数据类型 Possible values: 可能的值: 0 - (default默认) decimal; 1 - octal; 2 - hexadecimal; 3 - boolean.
必填
authtype
string
示例:0 SSH authentication method. Used only by SSH agent items. SSH认证方式。 仅用于SSH代理项 Possible values: 可能的值: 0 - (default) password; 1 - public key.
必填
username
string
示例: Username for authentication. Used by simple check, SSH, Telnet, database monitor and JMX items. 验证用户名。 用于简单检查,SSH,Telnet,数据库监控和JMX项 Required by SSH and Telnet items.需要SSH和Telnet项目。
必填
password
string
示例: Password for authentication. Used by simple check, SSH, Telnet, database monitor and JMX items.认证密码。 用于简单检查,SSH,Telnet,数据库监控和JMX项
必填
publickey
string
示例: Name of the public key file.公钥文件的名称
必填
privatekey
string
示例: Name of the private key file.私钥文件的名称
必填
mtime
string
示例:0 Time when the monitored log file was last updated. Used only by log items.受监控日志文件上次更新的时间。 仅用于日志项。
必填
lastns
string
示例:564054253 (readonly) Nanoseconds when the item was last updated. item上次更新时的纳秒 This property will only return a value for the period configured in ZBX_HISTORY_PERIOD. 此属性将仅返回ZBX_HISTORY_PERIOD中配置的时间段的值。
必填
flags
string
示例:0 (readonly) Origin of the item. item的来源 Possible values: 可能的值 0 - a plain item; 4 - a discovered item.
必填
interfaceid
string
示例:1 ID of the item's host interface. Used only for host items.项主机接口的ID。 仅用于主机项。 Optional for agent (active), internal, trapper, aggregate, database monitor and calculated items.适用于代理(活动),内部,陷阱,聚合,数据库监控和计算项。
必填
port
string
示例: Port monitored by the item. Used only by SNMP items.由项监视的端口。 仅由SNMP项使用。
必填
description
string
示例: Description of the item.item说明
必填
inventory_link
string
示例:0 ID of the host inventory field that is populated by the item. 由item填充的主机库存字段的ID。 Refer to the host inventory page for a list of supported host inventory fields and their IDs.请参阅主机清单页面以获取支持的主机清单字段及其ID的列表。 Default: 0.
必填
lifetime
string
示例:0s
必填
evaltype
string
示例:0
必填
id
number
示例:1 请求唯一标识号
必填

说明 / 示例

请求示例 { "jsonrpc": "2.0", "method": "item.get", "params": { "output": "extend", "hostids": "10084", "search": { "key_": "system" }, "sortfield": "name" }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 } 返回值 { "jsonrpc": "2.0", "result": [ { "itemid": "23298", "type": "0", "snmp_community": "", "snmp_oid": "", "hostid": "10084", "name": "Context switches per second", "key_": "system.cpu.switches", "delay": "1m", "history": "7d", "trends": "365d", "lastvalue": "2552", "lastclock": "1351090998", "prevvalue": "2641", "state": "0", "status": "0", "value_type": "3", "trapper_hosts": "", "units": "sps", "multiplier": "0", "delta": "1", "snmpv3_securityname": "", "snmpv3_securitylevel": "0", "snmpv3_authpassphrase": "", "snmpv3_privpassphrase": "", "snmpv3_authprotocol": "0", "snmpv3_privprotocol": "0", "snmpv3_contextname": "", "formula": "1", "error": "", "lastlogsize": "0", "logtimefmt": "", "templateid": "22680", "valuemapid": "0", "params": "", "ipmi_sensor": "", "data_type": "0", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "mtime": "0", "lastns": "564054253", "flags": "0", "interfaceid": "1", "port": "", "description": "", "inventory_link": "0", "lifetime": "0s", "evaltype": "0" }, { "itemid": "23299", "type": "0", "snmp_community": "", "snmp_oid": "", "hostid": "10084", "name": "CPU $2 time", "key_": "system.cpu.util[,idle]", "delay": "1m", "history": "7d", "trends": "365d", "lastvalue": "86.031879", "lastclock": "1351090999", "prevvalue": "85.306944", "state": "0", "status": "0", "value_type": "0", "trapper_hosts": "", "units": "%", "multiplier": "0", "delta": "0", "snmpv3_securityname": "", "snmpv3_securitylevel": "0", "snmpv3_authpassphrase": "", "snmpv3_privpassphrase": "", "snmpv3_authprotocol": "0", "snmpv3_privprotocol": "0", "snmpv3_contextname": "", "formula": "1", "error": "", "lastlogsize": "0", "logtimefmt": "", "templateid": "17354", "valuemapid": "0", "params": "", "ipmi_sensor": "", "data_type": "0", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "mtime": "0", "lastns": "564256864", "flags": "0", "interfaceid": "1", "port": "", "description": "The time the CPU has spent doing nothing.", "inventory_link": "0", "lifetime": "0s", "evaltype": "0" }, { "itemid": "23300", "type": "0", "snmp_community": "", "snmp_oid": "", "hostid": "10084", "name": "CPU $2 time", "key_": "system.cpu.util[,interrupt]", "history": "7d", "trends": "365d", "lastvalue": "0.008389", "lastclock": "1351091000", "prevvalue": "0.000000", "state": "0", "status": "0", "value_type": "0", "trapper_hosts": "", "units": "%", "multiplier": "0", "delta": "0", "snmpv3_securityname": "", "snmpv3_securitylevel": "0", "snmpv3_authpassphrase": "", "snmpv3_privpassphrase": "", "snmpv3_authprotocol": "0", "snmpv3_privprotocol": "0", "snmpv3_contextname": "", "formula": "1", "error": "", "lastlogsize": "0", "logtimefmt": "", "templateid": "22671", "valuemapid": "0", "params": "", "ipmi_sensor": "", "data_type": "0", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "mtime": "0", "lastns": "564661387", "flags": "0", "interfaceid": "1", "port": "", "description": "The amount of time the CPU has been servicing hardware interrupts.", "inventory_link": "0", "lifetime": "0s", "evaltype": "0" } ], "id": 1 }