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
Description
project_id
Yes
Specifies the project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
- Example
POST https://{Cloud Eye endpoint}/V1.0/{project_id}/events
Request
- Request parameters
Table 2 Parameter description Parameter
Type
Mandatory
Description
Arrays of objects
Yes
Specifies the event list.
Table 3 Array elements Parameter
Mandatory
Type
Description
event_name
Yes
String
Specifies the event name.
The value can be a string of 1 to 64 characters and must start with a letter and contain only uppercase letters, lowercase letters, digits, and underscores (_).
event_source
No
String
Specifies the event source.
The format is service.item. Set this parameter based on the site requirements.
service and item each must be a string that starts with a letter and contains 3 to 32 characters, including only uppercase letters, lowercase letters, digits, and underscores (_).
time
Yes
long
Specifies the time when the event occurred, which is a UNIX timestamp (ms).
NOTE:Since there is a latency between the client and the server, the data timestamp to be inserted should be within the period that starts from one hour before the current time plus 20s to 10 minutes after the current time minus 20s. In this way, the timestamp 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
Arrays of objects
Specifies the event details.
For details, see Table 4.
Table 4 detail field data structure description Parameter
Mandatory
Type
Description
content
No
String
Specifies the event content. The value can contain a maximum of 4096 characters.
resource_id
No
String
Specifies the resource ID. The value can contain a maximum of 128 characters, including letters, digits, underscores (_), hyphens (-), and colon (:).
Example: 6a69bf28-ee62-49f3-9785-845dacd799ec
To query the resource ID, perform the following steps:
- Log in to the management console.
- Under Computing, select Elastic Cloud Server.
On the Resource Overview page, obtain the resource ID.
resource_name
No
String
Specifies the resource name. The value can contain a maximum of 128 characters, including letters, digits, underscores (_), and hyphens (-).
event_state
No
String
Specifies the event status.
Valid value can be normal, warning, or incident.
event_level
No
String
Specifies the event severity.
Its value can be Critical, Major, Minor, or Info.
event_user
No
String
Specifies the event user.
The value can contain a maximum of 64 characters, including letters, digits, underscores (_), hyphens (-), slashes (/), and spaces.
- Example request
[{ "event_name":"systemInvaded", "event_source":"financial.Sytem", "time":1522121194000, "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_name":"systemInvaded", "event_source":"financial.Sytem", "time":1522121194020, "detail":{ "content":"The financial system was invaded", "group_id":"rg15221211517051YWWkEnVd", "resource_id":"1234567890sjgggad", "resource_name":"ecs001", "event_state":"normal", "event_level":"Major", "event_user":"xihong" } }]
Response
- Response parameters
Table 5 Parameter description Parameter
Type
Description
Arrays of objects
Specifies the event list.
Table 6 Response parameters Parameter
Mandatory
Type
Description
event_id
Yes
String
Specifies the event ID.
event_name
Yes
String
Specifies the event name.
The value can be a string of 1 to 64 characters and must start with a letter and contain only uppercase letters, lowercase letters, digits, and underscores (_).
- Example response
[ { "event_id":"evdgiqwgedkkcvhdjcdu346", "event_name":"systemInvaded" }, { "event_id":"evdgiqwgedkkcvhdjcdu347", "event_name":"systemParalysis" } ]
Returned Values
- Normal
- 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot