Updated on 2022-09-14 GMT+08:00

Querying Events

Function

This API is used to query the 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.

    event_type

    String

    No

    Specifies the event type. Possible types are EVENT.SYS (system event) and 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 time is a UNIX timestamp and the unit is ms. Example: 1605952700911

    to

    Integer

    No

    Specifies the end time of the query. The time is a UNIX timestamp and the unit is ms. from must be smaller than to. For example, set to to 1606557500911.

    start

    Integer

    No

    Specifies the start value of pagination. The value is an integer. 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
Table 2 Parameter description

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.

Table 3 events field description

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 last occurred.

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.

Table 4 meta_data data structure description

Parameter

Type

Mandatory

Description

total

Integer

No

Specifies the total number of events.

  • 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

    200

  • 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.