[comment]: # translation:outdated

[comment]: # ({9464a98f-9464a98f})
# event.get

[comment]: # ({/9464a98f-9464a98f})

[comment]: # ({a2311b6e-a2311b6e})
### Leírás

`integer/array event.get(objektumparaméterek)`

A módszer lehetővé teszi az események lekérését a megadott paraméterek szerint.

::: Fontos
Ez a módszer egy törölt entitás eseményeit adhatja vissza
ha ezeket az eseményeket a házvezetőnő nem távolította el
még.
:::

::: noteclassic
Ez a módszer bármilyen típusú felhasználó számára elérhető. Engedélyek
A metódus meghívása a felhasználói szerepkör beállításaiban visszavonható. Lásd: [User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
további információért.
:::

[comment]: # ({/a2311b6e-a2311b6e})

[comment]: # ({new-99511e47})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|eventids|string/array|Return only events with the given IDs.|
|groupids|string/array|Return only events created by objects that belong to the given host groups.|
|hostids|string/array|Return only events created by objects that belong to the given hosts.|
|objectids|string/array|Return only events created by the given objects.|
|source|integer|Return only events with the given type.<br><br>Refer to the [event object page](object#event) for a list of supported event types.<br><br>Default: 0 - trigger events.|
|object|integer|Return only events created by objects of the given type.<br><br>Refer to the [event object page](object#event) for a list of supported object types.<br><br>Default: 0 - trigger.|
|acknowledged|boolean|If set to `true` return only acknowledged events.|
|suppressed|boolean|`true` - return only suppressed events;<br>`false` - return events in the normal state.|
|severities|integer/array|Return only events with given event severities. Applies only if object is trigger.|
|evaltype|integer|Rules for tag searching.<br><br>Possible values:<br>0 - (default) And/Or;<br>2 - Or.|
|tags|array of objects|Return only events with given tags. Exact match by tag and case-insensitive search by value and operator.<br>Format: `[{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...]`.<br>An empty array returns all events.<br><br>Possible operator types:<br>0 - (default) Like;<br>1 - Equal;<br>2 - Not like;<br>3 - Not equal<br>4 - Exists;<br>5 - Not exists.|
|eventid\_from|string|Return only events with IDs greater or equal to the given ID.|
|eventid\_till|string|Return only events with IDs less or equal to the given ID.|
|time\_from|timestamp|Return only events that have been created after or at the given time.|
|time\_till|timestamp|Return only events that have been created before or at the given time.|
|problem\_time\_from|timestamp|Returns only events that were in the problem state starting with `problem_time_from`. Applies only if the source is trigger event and object is trigger. Mandatory if `problem_time_till` is specified.|
|problem\_time\_till|timestamp|Returns only events that were in the problem state until `problem_time_till`. Applies only if the source is trigger event and object is trigger. Mandatory if `problem_time_from` is specified.|
|value|integer/array|Return only events with the given values.|
|selectHosts|query|Return a [hosts](/manual/api/reference/host/object) property with hosts containing the object that created the event. Supported only for events generated by triggers, items or LLD rules.|
|selectRelatedObject|query|Return a `relatedObject` property with the object that created the event. The type of object returned depends on the event type.|
|select\_alerts|query|Return an [alerts](/manual/api/reference/alert/object) property with alerts generated by the event. Alerts are sorted in reverse chronological order.|
|select\_acknowledges|query|Return an `acknowledges` property with event updates. Event updates are sorted in reverse chronological order.<br><br>The event update object has the following properties:<br>`acknowledgeid` - `(string)` acknowledgment's ID;<br>`userid` - `(string)` ID of the user that updated the event;<br>`eventid` - `(string)` ID of the updated event;<br>`clock` - `(timestamp)` time when the event was updated;<br>`message` - `(string)` text of the message;<br>`action` - `(integer)` update action that was performed see [event.acknowledge](/manual/api/reference/event/acknowledge);<br>`old_severity` - `(integer)` event severity before this update action;<br>`new_severity` - `(integer)` event severity after this update action;<br>`username` - `(string)` username of the user that updated the event;<br>`name` - `(string)` name of the user that updated the event;<br>`surname` - `(string)` surname of the user that updated the event.<br><br>Supports `count`.|
|selectTags|query|Return a [tags](/manual/api/reference/event/object#Event_tag) property with event tags.|
|selectSuppressionData|query|Return a `suppression_data` property with the list of maintenances:<br>`maintenanceid` - `(string)` ID of the maintenance;<br>`suppress_until` - `(integer)` time until the event is suppressed.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `eventid`, `objectid` and `clock`.|
|countOutput|boolean|These parameters being common for all `get` methods are described in detail in the [reference commentary](/manual/api/reference_commentary#common_get_method_parameters) page.|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/new-99511e47})

[comment]: # ({7223bab1-7223bab1})
### Visszatérési értékek

`(integer/array)` A következőket adja vissza:

- objektumok tömbje;
- a letöltött objektumok száma, ha a `countOutput` paraméter rendelkezik
    használtak.

[comment]: # ({/7223bab1-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### Példák

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({new-7bd1e923})
#### Retrieving trigger events

Retrieve the latest events from trigger "13926."

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "event.get",
    "params": {
        "output": "extend",
        "select_acknowledges": "extend",
        "selectTags": "extend",
        "selectSuppressionData": "extend",
        "objectids": "13926",
        "sortfield": ["clock", "eventid"],
        "sortorder": "DESC"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "eventid": "9695",
            "source": "0",
            "object": "0",
            "objectid": "13926",
            "clock": "1347970410",
            "value": "1",
            "acknowledged": "1",
            "ns": "413316245",
            "name": "MySQL is down",
            "severity": "5",
            "r_eventid": "0",
            "c_eventid": "0",
            "correlationid": "0",
            "userid": "0",
            "opdata": "",
            "acknowledges": [
                {
                    "acknowledgeid": "1",
                    "userid": "1",
                    "eventid": "9695",
                    "clock": "1350640590",
                    "message": "Problem resolved.\n\r----[BULK ACKNOWLEDGE]----",
                    "action": "6",
                    "old_severity": "0",
                    "new_severity": "0",
                    "username": "Admin",
                    "name": "Zabbix",
                    "surname": "Administrator"
                }
            ],
            "suppression_data": [
                {
                    "maintenanceid": "15",
                    "suppress_until": "1472511600"
                }
            ],
            "suppressed": "1",
            "tags": [
                {
                    "tag": "service",
                    "value": "mysqld"
                },
                {
                    "tag": "error",
                    "value": ""
                }
            ]
        },
        {
            "eventid": "9671",
            "source": "0",
            "object": "0",
            "objectid": "13926",
            "clock": "1347970347",
            "value": "0",
            "acknowledged": "0",
            "ns": "0",
            "name": "Unavailable by ICMP ping",
            "severity": "4",
            "r_eventid": "0",
            "c_eventid": "0",
            "correlationid": "0",
            "userid": "0",
            "opdata": "",
            "acknowledges": [],
            "suppression_data": [],
            "suppressed": "0",
            "tags": []
        }
    ],
    "id": 1
}
```

[comment]: # ({/new-7bd1e923})

[comment]: # ({new-adbe5436})
#### Retrieving events by time period

Retrieve all events that have been created between October 9 and 10,
2012, in reverse chronological order.

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "event.get",
    "params": {
        "output": "extend",
        "time_from": "1349797228",
        "time_till": "1350661228",
        "sortfield": ["clock", "eventid"],
        "sortorder": "desc"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "eventid": "20616",
            "source": "0",
            "object": "0",
            "objectid": "14282",
            "clock": "1350477814",
            "value": "1",
            "acknowledged": "0",
            "ns": "0",
            "name": "Less than 25% free in the history cache",
            "severity": "3",
            "r_eventid": "0",
            "c_eventid": "0",
            "correlationid": "0",
            "userid": "0",
            "opdata": "",
            "suppressed": "0"
        },
        {
            "eventid": "20617",
            "source": "0",
            "object": "0",
            "objectid": "14283",
            "clock": "1350477814",
            "value": "0",
            "acknowledged": "0",
            "ns": "0",
            "name": "Zabbix trapper processes more than 75% busy",
            "severity": "3",
            "r_eventid": "0",
            "c_eventid": "0",
            "correlationid": "0",
            "userid": "0",
            "opdata": "",
            "suppressed": "0"
        },
        {
            "eventid": "20618",
            "source": "0",
            "object": "0",
            "objectid": "14284",
            "clock": "1350477815",
            "value": "1",
            "acknowledged": "0",
            "ns": "0",
            "name": "High ICMP ping loss",
            "severity": "3",
            "r_eventid": "0",
            "c_eventid": "0",
            "correlationid": "0",
            "userid": "0",
            "opdata": "",
            "suppressed": "0"
        }
    ],
    "id": 1
}
```

[comment]: # ({/new-adbe5436})

[comment]: # ({c6eb3ba0-c6eb3ba0})
### Lásd még

- [Alert](/manual/api/reference/alert/object)
- [Elem](/manual/api/reference/item/object)
- [Host](/manual/api/reference/host/object)
- [LLD szabály](/manual/api/reference/discoveryrule/object#lld_rule)
- [Trigger](/manual/api/reference/trigger/object)

[comment]: # ({/c6eb3ba0-c6eb3ba0})

[comment]: # ({f85dc7ca-f85dc7ca})
### Forrás

CEvent::get() az *ui/include/classes/api/services/CEvent.php*-ban.

[comment]: # ({/f85dc7ca-f85dc7ca})
