CloudMonitor can send alerts by using emails or webhooks. CloudMonitor can also send alerts by using the alert callback feature. You can handle alerts flexibly. 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
CloudMonitor 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: 47.74.206.0/26, 47.74.206.64/26, 47.74.206.128/26, 47.74.206.192/26, and 8.222.159.116/26. After you receive alert notifications, you can resolve issues based on the content of the alert notifications.
If an alert callback fails, CloudMonitor retries up to three times. The timeout period of each callback request is 5 seconds.
Procedure
- Log on to the CloudMonitor console.
- In the left-side navigation pane, choose .
On the System Event page, click the Event-triggered Alert Rules tab.
On the Event-triggered Alert Rules tab, 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.
In 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, you can check and troubleshoot the connectivity of the alert callback URL based on the returned status code and test result details.
NoteTo obtain the details of the test result, configure the Test Template Type and Language parameters and click Test.
Click Close.
Click OK.
Result
If the alert rule is triggered, CloudMonitor 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 CloudMonitor 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 event status. 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"
}