Beyond email, and webhook notifications, Cloud Monitor supports alert callbacks that forward threshold alerts to your O&M or messaging systems via HTTP POST.
Prerequisites
A public URL for your O&M or messaging system that accepts HTTP POST requests.
Background
-
Cloud Monitor sends alert notifications to your URL as HTTP or HTTPS POST requests. Add the following IP address ranges to your firewall allowlist:
47.74.206.0/26 47.74.206.64/26 47.74.206.128/26 47.74.206.192/26 8.222.159.116 -
Cloud Monitor retries failed callbacks up to three times with a 5-second timeout per request.
Bulk configuration of threshold alert callbacks is not available in the Cloud Monitor console. Use the following API operations instead:
-
Call CreateMetricRuleTemplate to create an alert template with a callback URL, then call ApplyMetricRuleTemplate to apply it to an application group.
-
Call PutGroupMetricRule to create or modify an alert rule for an application group with a callback URL.
Procedure
-
Log on to the Cloud Monitor console.
-
In the left-side navigation pane, choose .
-
On the Alert Rules page, find the desired alert rule and click Modify in its Actions column.
NoteYou can also create an alert rule.
-
In the Modify Alert Rule panel, enter the callback URL.
To test connectivity to the callback URL:
-
Click Test, located directly to the right of the callback URL.
In the WebHook Test panel, check the HTTP status code and test result details to verify connectivity.
NoteYou can also set the Test Template Type: and Language:. Then click Test again to view updated test results.
-
Click Close.
-
-
Click Confirm.
Results
When an alert triggers, Cloud Monitor sends a POST request to your callback URL with the following parameters.
The request body may include additional parameters in the future. Ensure your endpoint handles unknown parameters gracefully.
|
Parameter |
Type |
Description |
|
alertName |
String |
The alert name. |
|
alertState |
String |
The alert status. Valid values:
|
|
curValue |
String |
The metric value when the alert triggered or resolved. |
|
dimensions |
String |
The dimensions of the alerting resource. Example: |
|
expression |
String |
The condition that triggers the alert. |
|
groupId |
String |
The application group ID. |
|
instanceName |
String |
The instance name. |
|
lastTime |
String |
The alert duration. Unit: minutes. |
|
metricName |
String |
The metric name, as listed in the Metric Name column of Metrics for cloud services. |
|
metricProject |
String |
The cloud service name. For most services, |
|
namespace |
String |
The cloud service namespace. For most services, the callback For some services, the namespace differs from the callback |
|
preTriggerLevel |
String |
The previous alert severity level. Valid values:
|
|
productGroupName |
String |
The application group name. |
|
rawMetricName |
String |
The metric ID, as listed in the Metric Id column of Metrics for cloud services. |
|
regionId |
String |
The region ID. |
|
regionName |
String |
The region name. |
|
ruleId |
String |
The triggered alert rule ID. |
|
timestamp |
String |
The timestamp when the alert triggered. |
|
transId |
String |
A unique ID for an alert's lifecycle on a specific resource, from trigger to resolution. |
|
triggerLevel |
String |
The current alert severity level. Valid values:
|
|
unit |
String |
The metric unit, as listed in the Unit column of Metrics for cloud services. |
|
userId |
String |
The user ID. |
Table 1. Mappings between cloud service namespaces and callback namespaces
|
Cloud service namespace |
Callback namespace |
|
acs_ecs_dashboard |
acs_ecs |
|
acs_slb_dashboard |
acs_slb |
|
acs_rds_dashboard |
acs_rds |
|
acs_oss_dashboard |
acs_oss |
|
acs_sls_dashboard |
acs_sls |
|
acs_ess_dashboard |
acs_ess |
|
acs_containerservice_dashboard |
acs_containerservice |
|
acs_apigateway_dashboard |
acs_apigateway |
|
acs_redis_dashboard |
acs_kvstore |
|
acs_ocs_new |
acs_ocs |
|
acs_mns_new |
acs_mns |
Sample POST request:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
expression=$Average>=95&metricName=Host.mem.usedutilization&instanceName=instance-name-****&signature=eEq1zHuCUp0XSmLD8p8VtTKF****&metricProject=acs_ecs&userId=110803419679****&curValue=97.39&alertName=Basic Monitoring-ECS-Memory Usage&namespace=acs_ecs_dashboard&triggerLevel=WARN&alertState=ALERT&preTriggerLevel=WARN&ruleId=applyTemplateee147e59-664f-4033-a1be-e9595746****&dimensions={userId=110803419679****, instanceId=i-8psdh7l6lphbn10l****}×tamp=1508136760&productGroupName=test_Group&groupId=1666****&lastTime=2 minutes&rawMetricName=cpu_total®ionId=cn-hangzhou®ionName=China (Hangzhou)&transId=53767d2a-ae72-11ed-b2ca-00163e2c****&unit=%