Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com> Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com> Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
22 KiB
Querying Events
Function
This API is used to query events, including system events and custom events.
URI
GET /V1.0/{project_id}/events
- Parameter description
Table 1 Parameter description Parameter
Type
Mandatory
Description
project_id
String
Yes
Specifies the project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
Minimum: 1
Maximum: 64
Regular expression matching: ^[a-zA-Z0-9-]{1,64}$
event_type
String
No
Specifies the event type. The value can be EVENT.SYS (system event) or EVENT.CUSTOM (custom event).
event_name
String
No
Specifies the event name. The name can be a system event name or a custom event name.
from
Integer
No
Specifies the start time of the query. The value is a UNIX timestamp in milliseconds, for example, 1605952700911. A timestamp shorter than 13 digits is not recommended.
Maximum: 13
Minimum: 1
to
Integer
No
Specifies the end time of the query. The value is a UNIX timestamp in milliseconds. from must be earlier than to, for example, 1606557500911. A timestamp shorter than 13 digits is not recommended.
Maximum: 13
Minimum: 1
NOTE:If the format of the from and to parameters is incorrect, the monitoring data of the last day is displayed.
start
Integer
No
Specifies the pagination start value. The value is an integer. Specifies the page number. Its value is no less than 0. The default value is 0.
limit
Integer
No
Specifies the maximum number of events that can be queried at a time. Supported range: 1 to 100 (default)
- Example
GET https://{Cloud Eye endpoint}/V1.0/{project_id}/events
Request
None
Response
- Response parameters
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
events |
Array of Events objects |
No |
Specifies one or more pieces of event data. For details, see Table 3. |
meta_data |
MetaData object |
No |
Specifies the number of metadata records in the query result. For details, see Table 4. |
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
event_name |
String |
No |
Specifies the event name. |
event_type |
String |
No |
Specifies the event type. |
event_count |
Integer |
No |
Specifies the number of occurrences of this event within the specified query time range. |
latest_occur_time |
Long |
No |
Specifies when the event occurred. The value is a UNIX timestamp, in milliseconds. |
latest_event_source |
String |
No |
Specifies the event source. If the event is a system event, the source is the namespace of each service. To view the namespace of each service, see Services Interconnected with Cloud Eye. If the event is a custom event, the event source is defined by the user. |
- Example response
{ "events": [ { "event_name": "rebootServer", "event_type": "EVENT.SYS", "event_count": 5, "latest_occur_time": 1606302400000, "latest_event_source": "SYS.ECS" }, { "event_name": "deleteVolume", "event_type": "EVENT.SYS", "event_count": 6, "latest_occur_time": 1606300359126, "latest_event_source": "SYS.EVS" }, { "event_name": "event_001", "event_type": "EVENT.CUSTOM", "event_count": 4, "latest_occur_time": 1606499035522, "latest_event_source": "TEST.System" } ], "meta_data": { "total": 10 } }
Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
Request error.
401 Unauthorized
The authentication information is not provided or is incorrect.
403 Forbidden
Access to the requested page is forbidden.
408 Request Timeout
The request timed out.
429 Too Many Requests
Concurrent requests are excessive.
500 Internal Server Error
Failed to complete the request because of an internal service error.
503 Service Unavailable
The service is currently unavailable.
Error Codes
See Error Codes.