integer/array alert.get(object parameters) 整数/数组 alert.get(对象 参数)
The method allows to retrieve alerts according to the given parameters. 该方式允许根据给定的参数检索警报.
(object) Parameters defining the desired output. (object) 定义所需输出的参数.
The method supports the following parameters. 该方法支持以下参数.
| Parameter | Type | Description |
|---|---|---|
| 参数 类 | 描述 | |
| alertids | string/array | Return only alerts with the given IDs. |
| alertids | string/array | 只返回给定ID的alerts. |
| actionids | string/array | Return only alerts generated by the given actions. |
| actionids | string/array | 只返回给定actions生成的alerts. |
| eventids | string/array | Return only alerts generated by the given events. |
| eventids | string/array | 只返回给定事件生成的alerts. |
| groupids | string/array | Return only alerts generated by objects from the given host groups. |
| groupids | string/array | 只返回来自给定主机组的对象生成的alerts. |
| hostids | string/array | Return only alerts generated by objects from the given hosts. |
| hostids | string/array | 只返回来自给定主机的对象生成的alerts. |
| mediatypeids | string/array | Return only message alerts that used the given media types. |
| mediatypeids | string/array | 只返回用于给定报警媒介类型的消息警报. |
| objectids | string/array | Return only alerts generated by the given objects |
| objectids | string/array | 只返回给定对象生成的alerts |
| userids | string/array | Return only message alerts that were sent to the given users. |
| userids | string/array | 只返回发送给给定用户的消息警报. |
| eventobject | integer | Return only alerts generated by events related to objects of the given type. Refer to the event "object" property for a list of supported object types. Default: 0 - trigger. |
| eventsource | integer | Return only alerts generated by events of the given type. Refer to the event "source" property for a list of supported event types. Default: 0 - trigger events. |
| time_from | timestamp | Return only alerts that have been generated after the given time. |
| time_till | timestamp | Return only alerts that have been generated before the given time. |
| 事件对象 整数 | 只返回与给 | 类型的对象相关的事件生成的警报. 有关支持对象类型的列表,请参阅event "object" property . 默认值: 0 - 触发器. |
| 事件来源 整数 | 只返回给定 | 型的事件生成的警报. 有关支持事件类型的列表,请参阅 event "source" property . 默认值: 0 - 触发事件. |
| time_from | 时间戳 只返 | 在给定时间之后生成的警报. |
| time_till | 时间戳 只返 | 在给定时间之前生成的警报. |
| selectHosts | query | Return the hosts that triggered the action operation in the hosts property. |
| selectHosts | query | 在“hosts”属性中返回触发action操作的主机. |
| selectMediatypes | query | Return the media type that was used for the message alert as an array in the mediatypes property. |
| selectMediatypes | query | 将用于消息警报的报警媒介类型作为“mediatypes”属性中的数组返回. |
| selectUsers | query | Return the user that the message was addressed to as an array in the users property. |
| selectUsers | query | 将消息被寻址的用户作为“users”属性中的数组返回. |
| sortfield | string/array | Sort the result by the given properties. Possible values are: alertid, clock, eventid and status. |
| sortfield | string/array | 按给定属性的结果进行排序. \\可能的值为: alertid, clock, eventid 还有status. |
| countOutput | flag | These parameters being common for all get methods are described in the reference commentary. |
| countOutput | flag | 在reference commentary中描述了所有“get”方法的共同参数. |
| editable | boolean | |
| excludeSearch | flag | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | flag | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | flag | |
(integer/array) Returns either:
countOutput parameter has been used.Retrieve all alerts generated by action "3".
Request:
{
"jsonrpc": "2.0",
"method": "alert.get",
"params": {
"output": "extend",
"actionids": "3"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}Response:
{
"jsonrpc": "2.0",
"result": [
{
"alertid": "1",
"actionid": "3",
"eventid": "21243",
"userid": "1",
"clock": "1362128008",
"mediatypeid": "1",
"sendto": "[email protected]",
"subject": "PROBLEM: Zabbix agent on Linux server is unreachable for 5 minutes: ",
"message": "Trigger: Zabbix agent on Linux server is unreachable for 5 minutes: \nTrigger status: PROBLEM\nTrigger severity: Not classified",
"status": "0",
"retries": "3",
"error": "",
"esc_step": "1",
"alerttype": "0"
}
],
"id": 1
}CAlert::get() in frontends/php/include/classes/api/services/CAlert.php.