Reporting Events and Alarms
Function
This API is used to report events and alarms of a user.
URI
PUT /v2/{project_id}/push/events
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID obtained from IAM. Generally, a project ID contains 32 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
action |
No |
String |
Requested action. clear: The alarm is to be cleared. If this parameter is not transferred or other values are transferred, the alarm is reported by default. Enumeration values:
|
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
Content-Type |
Yes |
String |
Content type, which is application/json. Enumeration values:
|
x-enterprise-prject-id |
No |
String |
ID of the enterprise project to which the alarm belongs. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
events |
Yes |
Array of EventModel objects |
Event or alarm details. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
starts_at |
No |
Long |
Time when an event or alarm is generated (CST timestamp precise down to the millisecond). |
ends_at |
No |
Long |
Time when an event or alarm is cleared (CST timestamp precise down to the millisecond). 0: The event or alarm is not deleted. |
timeout |
No |
Long |
Duration (in milliseconds) at which an alarm is automatically cleared. For example, if an alarm needs to be automatically cleared in one minute, set this parameter to 60000. The default value is 3 days (that is, 3 days x 24 hours x 60 minutes x 1000 ms = 4,320,000 ms). |
metadata |
No |
Map<String,String> |
Details of an event or alarm. The value is a key-value pair. The following fields are mandatory:
|
annotations |
No |
Map<String,String> |
Additional field for an event or alarm, which can be left blank. |
attach_rule |
No |
Map<String,String> |
Reserved field for an event or alarm, which can be left blank. |
id |
No |
String |
Event or alarm ID, which is automatically generated by the system. |
Response Parameters
None
Example Requests
Report an alarm named "test".
https://{EndPoint}/v2/{project_id}/push/events { "events" : [ { "starts_at" : 1605232501000, "timeout" : 60000, "metadata" : { "event_name" : "test", "event_severity" : "Major", "event_type" : "alarm", "resource_provider" : "ecs", "resource_type" : "vm", "resource_id" : "ecs123" }, "annotations" : { "alarm_probableCause_zh_cn" : "Possible Causes", "alarm_fix_suggestion_zh_cn" : "Suggestions", "message" : "Alarm Details" }, "attach_rule" : { } } ] }
Example Responses
None
Status Codes
Status Code |
Description |
---|---|
204 |
OK: The request is successful. |
400 |
Bad Request: The request is invalid. The client should not repeat the request without modifications. |
401 |
Unauthorized: The authentication information is incorrect or invalid. |
403 |
Forbidden: The request is rejected. The server has received the request and understood it, but the server refuses to respond to it. The client should not repeat the request without modifications. |
500 |
Internal Server Error: The server is able to receive the request but unable to understand the request. |
503 |
Service Unavailable: The requested service is invalid. The client should not repeat the request without modifications. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.