Files
doc-exports/docs/ces/api-ref/en-us_topic_0109034020.html
qiujiandong1 e9265fb6b0 CES API Update -20250521 version
Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2025-12-05 10:48:24 +00:00

35 KiB
Raw Permalink Blame History

Reporting Events

Function

An API for reporting custom events is provided, which helps you collect and report abnormal events or important change events to Cloud Eye.

URI

POST /V1.0/{project_id}/events

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    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}$

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

Request

Events with the same time, project_id, event_source, event_name, event_type, event_state, event_level, event_user, resource_id and resource_name fields are considered as the same event.

  • Request parameters
    Table 2 Parameter description

    Parameter

    Mandatory

    Type

    Description

    [Array element]

    Yes

    Array of EventItem objects

    Specifies the event list.

    Table 3 Parameter description of the EventItem field

    Parameter

    Mandatory

    Type

    Description

    event_name

    Yes

    String

    Specifies the event name.

    Start with a letter. Enter 1 to 64 characters. Only letters, digits, and underscores (_) are allowed.

    event_source

    Yes

    String

    Specifies the event source. This parameter can be left empty. An empty value indicates all sources.

    The format is service.item. Set this parameter based on the service needs.

    service and item each must start with a letter and contain only letters, digits, and underscores (_). The value can contain 0 to 32 characters.

    time

    Yes

    Long

    Specifies when the event occurred, which is a UNIX timestamp (ms).

    NOTE:

    Since there is a latency between the client and the server, the timestamp when data was inserted must be within the time range [Current time 1h + 20s, Current time + 10 mins 20s]. In this way, the data will be inserted to the database without being affected by the latency.

    For example, if the current time is 2020.01.30 12:00:30, the timestamp inserted must be within the range [2020.01.30 11:00:50, 2020.01.30 12:10:10]. The corresponding UNIX timestamp is [1580353250, 1580357410].

    detail

    Yes

    Detail object

    Specifies the event details.

    For details, see Table 4.

    Table 4 detail data structure description

    Parameter

    Mandatory

    Type

    Description

    content

    No

    String

    Specifies the event content. Enter up to 4,096 characters.

    NOTE:

    In some scenarios, this field does not support \n. When this happens, \n is preferentially converted to \\n.

    group_id

    No

    String

    Specifies the resource group the event belongs to.

    This ID must be an existing resource group ID.

    To query the group ID, perform the following steps:

    1. Log in to the management console.
    2. Click Cloud Eye.
    3. Choose Resource Groups.

      Obtain the resource group ID in the Name /ID column.

    resource_id

    No

    String

    Specifies the resource ID. Enter up to 128 characters, including letters, digits, underscores (_), hyphens (-), and colon (:).

    Example: 6a69bf28-ee62-49f3-9785-845dacd799ec

    To query the resource ID, perform the following steps:

    1. Log in to the management console.
    2. Under Computing, select Elastic Cloud Server.

      On the Resource Overview page, obtain the resource ID.

    resource_name

    No

    String

    Specifies the resource name. Enter up to 128 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

    event_state

    No

    String

    Specifies the event status.

    The value can be normal, warning, or incident.

    event_level

    No

    String

    Specifies the event severity.

    The value can be Critical, Major, Minor, or Info.

    event_user

    No

    String

    Specifies the event user.

    Enter up to 64 characters, including letters, digits, underscores (_), hyphens (-), slashes (/), and spaces.

    event_type

    No

    String

    Specifies the event type.

    Its value can be EVENT.SYS or EVENT.CUSTOM. EVENT.SYS indicates system events that cannot be reported by users. Only custom events can be reported.

    dimensions

    No

    Array of objects

    Specifies the event dimension. Currently, a maximum of four dimensions are supported. Resource information is described by dimension.

    Event alarm rules can be configured by dimension to monitor resources and resource groups.

    For parameter details, see Table 5.

    Table 5 dimensions data structure description

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    Specifies the monitoring dimension name. For example, the ECS dimension is instance_id. For details about the dimension of each monitored object, see the documentation of a specific cloud service. You can navigate there directly from the Services Interconnected with Cloud Eye page.

    value

    String

    Yes

    Specifies the dimension value, for example, an ECS ID.

    The value contains 1 to 256 characters.

  • Example request
    [
     {
      "event_name": "systemInvaded",
      "event_source": "financial.System",
      "time": 1742264993000,
      "detail": {
       "content": "The financial system was invaded",
       "group_id": "rg15221211517051YWWkEnVd",
       "resource_id": "1234567890sjgggad",
       "resource_name": "ecs001",
       "event_state": "normal",
       "event_level": "Major",
       "event_user": "xiaokong",
       "event_type": "EVENT.CUSTOM",
       "dimensions": [
        {
         "name": "instance_id",
         "value": "instance_xxx"
        }
       ]
      }
     }
    ]

Response

  • Response parameters
    Table 6 Parameter description

    Parameter

    Type

    Description

    Array elements

    Array of objects

    Specifies the event list.

    For details, see Table 7.

    Table 7 Response parameters

    Parameter

    Mandatory

    Type

    Description

    event_id

    Yes

    String

    Specifies the event ID.

    event_name

    Yes

    String

    Specifies the event name.

    Start with a letter. Enter 1 to 64 characters. Only letters, digits, and underscores (_) are allowed.

  • Example response
    [
           {
                "event_id":"evdgiqwgedkkcvhdjcdu346",
                "event_name":"systemInvaded"
            }
    ]

Returned Values

  • Normal

    201

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