Domain name for API request: monitor.tencentcloudapi.com.
This API is used to create an alarm policy.
A maximum of 20 requests can be initiated per second for this API.
Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: monitor.ap-shanghai-fsi.tencentcloudapi.com
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common parameter. The value used for this API: CreateAlarmPolicy. |
Version | Yes | String | Common parameter. The value used for this API: 2018-07-24. |
Region | Yes | String | Common parameter. For more information, please see the list of regions supported by the product. |
Module | Yes | String | Value fixed at "monitor" |
PolicyName | Yes | String | Policy name, which can contain up to 20 characters |
MonitorType | Yes | String | Monitor type. Valid values: MT_QCE (Tencent Cloud service monitoring) |
Namespace | Yes | String | Alarm policy type such as cvm_device, which is obtained through the DescribeAllNamespaces API |
Remark | No | String | Remarks with up to 100 letters, digits, underscores, and hyphens |
Enable | No | Integer | Whether to enable. Valid values: 0 (no), 1 (yes). Default value: 1. This parameter can be left empty |
ProjectId | No | Integer | Project ID. Valid values: -1 (no project), 0 (default project). Default value: -1. This parameter can be left empty |
Condition | No | AlarmPolicyCondition | Metric trigger condition |
EventCondition | No | AlarmPolicyEventCondition | Event trigger condition |
NoticeIds.N | No | Array of String | List of notification rule IDs, which is obtained through the DescribeAlarmNotices API |
TriggerTasks.N | No | Array of AlarmPolicyTriggerTask | Triggered task list |
Parameter Name | Type | Description |
---|---|---|
PolicyId | String | Alarm policy ID |
OriginId | String | Policy ID for instance/instance group binding and unbinding APIs (BindingPolicyObject, UnBindingAllPolicyObject, UnBindingPolicyObject) |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
This example shows you how to bind two notification rules and one auto scaling policy where the policy type is "CVM - basic monitoring", triggering metric is "CPU utilization >= 99.9%", and triggering event is "unreachable by ping".
POST / HTTP/1.1
Host: monitor.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAlarmPolicy
<Common request parameters>
{
"Module": "monitor",
"PolicyName": "CVM alarm policy",
"Remark": "This is the remark",
"MonitorType": "MT_QCE",
"Enable": 1,
"ProjectId": 0,
"Namespace": "cvm_device",
"Condition": {
"IsUnionRule": 1,
"Rules": [
{
"MetricName": "cpu_usage",
"Period": 60,
"Operator": "ge",
"Value": "99.9",
"ContinuePeriod": 1,
"NoticeFrequency": 3600,
"IsPowerNotice": 0
}
]
},
"EventCondition": {
"Rules": [
{
"MetricName": "ping_unreach"
}
]
},
"NoticeIds": [
"notice-bv9b4ghqbg",
"notice-gj2n9wnt29"
],
"TriggerTasks": [
{
"Type": "AS",
"TaskConfig": "{\"Region\":\"ap-guangzhou\",\"Group\":\"asg-0zhspjx\",\"Policy\":\"asp-ganig28\"}"
}
]
}
{
"Response": {
"RequestId": "29ghj2hh-45-h53h234h-23",
"PolicyId": "policy-hi498gw3h2",
"OriginId": "1234556"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation | Operation failed. |
InternalError | Internal error. |
InvalidParameter | Invalid parameter. |
InvalidParameterValue | The parameter value is incorrect. |
ResourceNotFound | The resource is not found. |
UnsupportedOperation | Unsupported operation. |
Was this page helpful?