Callback Interface
Definition
The publicly accessible http service address is used as the callback address. When an alert is triggered, the cloud monitoring will push the alert to this address.
After creating a webhook, your system can receive alert information. When an alert occurs, the cloud monitoring will send the alert information to the specified URL via HTTP POST, and you can process the received information.
Conditions
Users need to provide an HTTP service that receives POST requests to handle the POST requests sent by cloud monitoring, and register the URL of this service in the alarm system of the cloud platform.
JSON Body Example
Alert
{
SessionID: "xxxxxxxxxxxxxxxxxxxxxxx",
Region: " cn-north-03",
ResourceType: "uhost",
ResourceId: "uhost-xxxx",
MetricName: "MemUsage",
AlarmTime: 1458733318,
RecoveryTime : 0,
Content:"【Cloud Monitoring】Alert: Beijing 2 2023-08-05 11:30:04 uhost(ID:uhost-xxxx-0.0.0.0-) connection count(330.00)<6000(Monitoring item)"
}
Recovery
{
SessionID: "xxxxxxxxxxxxxxxxxxxxxxx",
Region: "cn-north-03",
ResourceType: "uhost",
ResourceId: "uhost-xxxx",
MetricName: "MemUsage",
AlarmTime: 0,
RecoveryTime: 1458733318,
Content:"【Cloud Monitoring】Alert Recovery: Beijing 2 2023-08-05 11:30:04 uhost(ID:uhost-xxxx-0.0.0.0-) connection count(330.00)<6000(Monitoring item)"
}
Field Explanation
Field | Explanation |
---|---|
SessionID | Session ID for this message |
Region | Region Name |
ResourceType | Resource Type |
MetricName | Metric Name for current warning |
AlarmTime | Alarm time |
RecoveryTime | Recovery time |
Content | Warning content |
Response
We need to receive such a response, indicating that the user has successfully received the push information, otherwise it will retry 2 times:
{
SessionID: "xxxxxxxxxxxxxxxxxxxxxxx",
RetCode: 0
}