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

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

    For details about how to obtain the project ID, see Obtaining a Project ID.

  • Example
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/events

Request

Table 2 Parameter description

Parameter

Type

Mandatory

Description

event_type

string

No

Specifies the event type. Possible values are EVENT.SYS, indicating a system event, and EVENT.CUSTOM, indicating a custom event.

event_name

string

No

Specifies the event name. The value 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 and the unit is ms. Example: 1605952700911

to

integer

No

Specifies the end time of the query. The value is a UNIX timestamp and the unit is ms. The value of from must be smaller than that of 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 the custom alarm template that can be queried at a time. The value range is (0,100] and the default value is 100.

Response

  • Response parameters
Table 3 Parameter description

Parameter

Type

Mandatory

Description

events

Array of Events objects

No

Specifies one or more pieces of event data.

meta_data

MetaData object

No

Specifies the number of metadata records in the query result.

Table 4 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

String

No

Specifies the number of occurrences of this event within the specified query time range.

latest_occur_time

String

No

Specifies the time when the event last occurred.

latest_event_source

String

No

Specifies the event source. If the event is a system event, the value 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 5 meta_data field 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.Sytem"
       }
     ],
     "meta_data": {
       "total": 10
     }
    }

Returned Value

  • Normal

    200

  • Abnormal

    Returned Values

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    You are forbidden to access the page requested.

    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 Code

For details, see Error Codes.