获取
Description 描述
integer/array problem.get(object **parameters**)
The method allows to retrieve problems according to the given parameters. 此方法允许根据给定参数检索符合条件的问题
Parameters 参数
(object)
Parameters defining the desired output. (object)
定义所需输出的参数
The method supports the following parameters. 此方法支持一下参数
Parameter | Type | Description |
---|---|---|
eventids | string/array | Return only problems with the given IDs. 仅返回所给IDs的问题 |
groupids | string/array | Return only problems created by objects that belong to the given host groups. 仅返回所属给定主机组对象的问题 |
hostids | string/array | Return only problems created by objects that belong to the given hosts. 仅返回所给定主机对象的问题 |
objectids | string/array | Return only problems created by the given objects. 仅返回所给对象创建的问题 |
applicationids | string/array | Return only problems created by objects that belong to the given applications. Applies only if object is trigger or item. 只返回属于给定应用程序的对象创建的问题。仅当对象是触发器或监控项时才应用。 |
source | integer | Return only problems with the given type. Refer to the problem event object page for a list of supported event types. Default: 0 - problem created by a trigger. 只返回给定类型的问题 跳转到problem event object page 用于支持事件类型的列表。 \默认:0 - 触发器创建的问题 |
object | integer | Return only problems created by objects of the given type. Refer to the problem event object page for a list of supported object types. Default: 0 - trigger. 只返回由给定类型的对象创建的问题 \跳转到 problem event object page 用于支持事件类型的列表 \默认:0-触发器 |
acknowledged | boolean | true - return acknowledged problems only;false - unacknowledged only. true -返回已知晓的问题返回未知晓的问题 |
severities | integer/array | Return only problems with given event severities. Applies only if object is trigger. 只返回给定事件严重程度的问题。仅当对象是触发器时才应用。 |
evaltype | integer | Rules for tag searching. Possible values: 0 - (default) And/Or; 2 - Or. 规则标签搜索。 \可能的值: 0 - (默认)与/或 ;2 - 或 |
tags | array of objects | Return only problems with given tags. Exact match by tag and case-insensitive search by value and operator. Format: [{“tag”: “<tag>”, “value”: “<value>”, “operator”: “<operator>”}, …] .An empty array returns all problems. Possible operator types: 0 - (default) Like; 1 - Equal. 只返回给定标签的问题。按标记精确匹配,按值和运算符不区分大小写搜索。 格式: [{“tag”: “<tag>”, “value”: “<value>”, “operator”: “<operator>”}, …] .空数组返回所有问题 可能的分隔类型: 0 - (默认) 相似 1 - 相等 |
recent | string | true - return PROBLEM and recently RESOLVED problems (depends on Display OK triggers for N seconds) Default: false - UNRESOLVED problems only true - 返回问题和最近已解决的问题(依赖于最近N秒显示OK的触发器) 默认:false - 仅真正未处理的问题 |
eventid_from | string | Return only problems with IDs greater or equal to the given ID. 只返回ID大于或等于给定ID的问题。 |
eventid_till | string | Return only problems with IDs less or equal to the given ID. 只返回ID小于或等于给定ID的问题。 |
time_from | timestamp | Return only problems that have been created after or at the given time. 仅返回问题创建时间在所给时间之后的问题 |
time_till | timestamp | Return only problems that have been created before or at the given time. 仅返回问题创建时间在所给时间之前的问题 |
selectAcknowledges | query |
Examples 示例如下
Retrieving trigger problem events 返回触发器问题事件
Retrieve recent events from trigger “15112.” 返回最近触发器id是15112的事件
Request:
{
"jsonrpc": "2.0",
"method": "problem.get",
"params": {
"output": "extend",
"selectAcknowledges": "extend",
"selectTags": "extend",
"objectids": "15112",
"recent": "true",
"sortfield": ["eventid"],
"sortorder": "DESC"
},
"auth": "67f45d3eb1173338e1b1647c4bdc1916",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"eventid": "1245463",
"source": "0",
"object": "0",
"objectid": "15112",
"clock": "1472457242",
"ns": "209442442",
"r_eventid": "1245468",
"r_clock": "1472457285",
"r_ns": "125644870",
"correlationid": "0",
"userid": "1",
"name": "Zabbix agent on localhost is unreachable for 5 minutes",
"acknowledged": "1",
"severity": "3",
"acknowledges": [
{
"acknowledgeid": "14443",
"userid": "1",
"eventid": "1245463",
"clock": "1472457281",
"message": "problem solved",
"action": "6",
"old_severity": "0",
"new_severity": "0"
}
],
"tags": [
{
"tag": "test tag",
"value": "test value"
}
]
}
],
"id": 1
}
See also
Source
CEvent::get() in frontends/php/include/classes/api/services/CProblem.php.