In addition to emails, Cloud Monitor provides the alert callback feature to send alert notifications. You can flexibly handle alert events by using callback URLs. This topic describes how to use the alert callback feature to send the notifications for system event-triggered alerts to your O&M system or notification system.
Prerequisites
The public URL of your O&M system or notification system is available. The URL can be used to access your O&M system or notification system.
Background information
The system event-triggered alert rule feature of the old version is no longer upgraded and will be phased out. We recommend that you use the alert callback feature in event subscription. For more information, see Configure callbacks for system event-triggered alerts (recommended).
Cloud Monitor sends alert notifications to the specified URL by using the HTTP or HTTPS POST method. You must add the following CIDR blocks to the whitelist of your firewall. After you receive alert notifications, you can resolve issues based on the content of the alert notifications.
If an alert callback fails, Cloud Monitor retries up to three times. The timeout period of each callback request is 5 seconds.
Procedure
Log on to the Cloud Monitor console.
In the left-side navigation pane, choose .
On the Event Monitoring tab, click Old Event Alarm Rules in the upper-right corner.
Find the alert rule that you want to modify and click Modify in the Actions column.
NoteYou can also create alert rules for system events. For more information, see Create a system event-triggered alert rule.
At the bottom of the Create/Modify Event-triggered Alert Rule panel, select URL Callback.
Set Request Method to POST and enter a callback URL.
To test the connectivity of an alert callback URL, perform the following steps:
Click Test next to the callback URL.
In the Webhook Test panel, set Language to Simplified Chinese or English, and check and troubleshoot the connectivity of the callback URL based on the returned status code and test result details.
Click Close.
Click OK.
Test the event-triggered alert rule.
Find the alert rule that you want to test, click the
icon in the Actions column, and then click Test.
In the Create Event Test panel, select the event to be tested.
Click OK.
Cloud Monitor automatically sends a test alert notification to the alert contact.
Result
If the alert rule is triggered, Cloud Monitor sends an alert notification to the callback URL by using the HTTP or HTTPS POST method. The following table describes the parameters that are configured in the POST request.
Parameter | Data type | Description |
traceId | String | The ID of the event that the cloud service reports to Cloud Monitor for troubleshooting. |
resourceId | String | The resource ID. |
product | String | The name of the cloud service. For more information about the cloud services that support system event-triggered alerts, see Appendix 2: System events. |
ver | String | The event version. |
instanceName | String | The instance name of the specified cloud service. |
level | String | The severity level of the event. Valid values:
|
groupId | String | The ID of the application group. |
eventTime | String | The timestamp that indicates the time when the event occurs, in the date format. Specify the time in the ISO 8601 standard in the |
userId | String | The ID of the current account. |
content | String | The event content. |
regionId | String | The region ID. |
name | String | The event name. For more information about the names of the events that are supported by each Alibaba Cloud service, see Appendix 2: System events. |
ruleName | String | The name of the alert rule. |
id | String | The event ID. |
status | String | The status of the event. For more information about the event status of each Alibaba Cloud service, see Appendix 2: System events. |
Sample POST request
{ "resourceId":"acs:ecs:cn-hangzhou:130013558060****:instance/i-j6c9pagb27uzlikj****", "product":"ECS", "ver":"1.0", "instanceName":"zabank-prd-infra-ZAGateway-service-0****", "level":"INFO", "groupId":"", "eventType":"StatusNotification", "userId":"130013558060****", "content":{ "resourceId":"i-j6c9pagb27uzlikj****", "instanceName":"zabank-prd-infra-ZAGateway-service-0****", "instanceType":"ecs.c6e.large", "state":"Deleted", "privateIpAddress":"10.48.XX.XX", "resourceType":"ALIYUN::ECS::Instance" }, "regionId":"cn-hangzhou", "eventTime":"20230217T103516.475+0800", "name":"Instance:StateChange", "ruleName":"ECS Event-triggered Alert Rule (New)", "id":"bd5f9913-ec1d-412b-ace3-7a3618d7****", "status":"Normal" }