该方式允许根据给定的参数检索警报.
参数
(object)
定义所需输出的参数。
该方法支持以下参数.
返回值
(integer/array)
Returns either:
an array of objects;
范例
通过动作 ID 检索警报
Retrieve all alerts generated by action “3”.
请求:
Source
CAlert::get() in frontends/php/include/classes/api/services/CAlert.php.
Description
integer/array alert.get(object **parameters**)
The method allows to retrieve alerts according to the given parameters.
Parameters
(object)
Parameters defining the desired output.
The method supports the following parameters.
Parameter | Type | Description |
---|---|---|
alertids | string/array | Return only alerts with the given IDs. |
actionids | string/array | Return only alerts generated by the given actions. |
eventids | string/array | Return only alerts generated by the given events. |
groupids | string/array | Return only alerts generated by objects from the given host groups. |
hostids | string/array | Return only alerts generated by objects from the given hosts. |
mediatypeids | string/array | Return only message alerts that used the given media types. |
objectids | string/array | Return only alerts generated by the given objects |
userids | string/array | Return only message alerts that were sent to the given users. |
eventobject | integer | Return only alerts generated by events related to objects of the given type. Refer to the 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. |
selectHosts | query | Return the hosts that triggered the action operation in the hosts property. |
selectMediatypes | query | Return the media type that was used for the message alert as an array in the mediatypes property. |
selectUsers | query | Return the user that the message was addressed to as an array in the property. |
sortfield | string/array | Sort the result by the given properties. Possible values are: alertid , clock , eventid and status . |
countOutput | boolean | These parameters being common for all get methods are described in the . |
editable | boolean | |
excludeSearch | boolean | |
filter | object | |
limit | integer | |
output | query | |
preservekeys | boolean | |
search | object | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | boolean |
an array of objects;
the count of retrieved objects, if the
countOutput
parameter has been used.
Examples
Retrieve alerts by action ID
Retrieve all alerts generated by action “3”.
Request:
Response: