Domain name for API request: cls.intl.tencentcloudapi.com.
This API is used to create an alarm policy.
A maximum of 20 requests can be initiated per second for this API.
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 Params. The value used for this API: CreateAlarm. |
| Version | Yes | String | Common Params. The value used for this API: 2020-10-16. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| Name | Yes | String | Alarm policy name. Supports a maximum of 255 bytes. Unsupported ' |
| AlarmTargets.N | Yes | Array of AlarmTarget | Monitoring object list. |
| MonitorTime | Yes | MonitorTime | Monitoring task execution time point. |
| TriggerCount | Yes | Integer | Duration cycle. An alarm is triggered after trigger conditions are constantly met for TriggerCount cycles. Minimum value is 1. Maximum value is 2000. |
| AlarmPeriod | Yes | Integer | Alarm repeat cycle in minutes. Value ranges from 0 to 1440. |
| Condition | No | String | Trigger conditions for sending alarm notifications
|
| AlarmLevel | No | Integer | Alarm level
|
| MultiConditions.N | No | Array of MultiCondition | Multiple trigger conditions
|
| Status | No | Boolean | Whether to enable alarm policy. |
| MessageTemplate | No | String | User-defined alarm content |
| CallBack | No | CallBackInfo | user-defined callback |
| Analysis.N | No | Array of AnalysisDimensional | Multi-dimensional analysis |
| GroupTriggerStatus | No | Boolean | Group trigger status. |
| GroupTriggerCondition.N | No | Array of String | Group trigger conditions. |
| Tags.N | No | Array of Tag | Tag description list. Tags can be bound to the corresponding alarm policy simultaneously by specifying this parameter. It supports up to 10 tag key-value pairs, which cannot be duplicate. |
| MonitorObjectType | No | Integer | Monitored object type. 0: Common monitoring object for execution statements; 1: Each execution statement selects its own monitored object. |
| Classifications.N | No | Array of AlarmClassification | Alert additional classification information list. |
| AlarmNoticeIds.N | No | Array of String | List of associated log service alarm notification channel groups. - Search the associated alarm notification channel group list via Get Notification Channel Group List, mutually exclusive with MonitorNotice. |
| MonitorNotice | No | MonitorNotice | The associated observability platform notification template is mutually exclusive with the AlarmNoticeIds parameter and cannot be used simultaneously. |
| Parameter Name | Type | Description |
|---|---|---|
| AlarmId | String | Alert policy ID. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Create alarm policy
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAlarm
<Common request parameters>
{
"Name": "test-p0 Alarm Policy"
"AlarmTargets": [
{
"Query": "level:error | select count(*) as cnt limit 100",
"Number": 1,
"StartTimeOffset": -15,
"EndTimeOffset": 0,
"SyntaxRule": 1,
"LogsetId": "ad5a574c-xxxx-xxxx-bb67-990d0cb9747a",
"TopicId": "test-cos-1254111111"
}
],
"MonitorTime": {
"Type": "Period",
"Time": 1
},
"TriggerCount": 1,
"AlarmPeriod": 15,
"AlarmNoticeIds": [
"notice-1a2c6c17-xxxx-xxxx-81be-25248ada5a4c"
],
"Status": true,
"MessageTemplate": "{{.Label}}",
"CallBack": {
"Headers": [],
"Body": ""
},
"Analysis": [
{
"Name": "Custom Search and Analysis"
"Type": "query",
"Content": "level:error | select err limit 100",
"ConfigInfo": [
{
"Key": "SyntaxRule",
"Value": "1"
}
]
}
],
"GroupTriggerStatus": false,
"GroupTriggerCondition": [],
"Tags": [],
"MonitorObjectType": 0,
"Classifications": [],
"MultiConditions": [
{
"Condition": "[$1.__QUERYCOUNT__]> 10000",
"AlarmLevel": 0
}
]
}
{
"Response": {
"AlarmId": "alarm-37cd7e19-xxxx-xxxx-82cc-00713ef449f6",
"RequestId": "ab6b1233-xxxx-xxxx-91f5-c6fad91966fe"
}
}
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 |
|---|---|
| InternalError | Internal error. |
| InvalidParameter | Incorrect parameter. |
| InvalidParameter.AlarmConflict | The alarm policy already exists. |
| MissingParameter | Missing parameter. |
| OperationDenied | Operation denied. |
| OperationDenied.ACLFailed | ACL verification failed. |
| OperationDenied.AccountDestroy | The account has been terminated. |
| OperationDenied.AccountIsolate | The account has overdue payments. |
| OperationDenied.AccountNotExists | The account does not exist. |
| OperationDenied.AlarmNotSupportForSearchLow | IA storage does not support alarms. |
| ResourceNotFound.AlarmNoticeNotExist | The alarm notification template does not exist. |
| ResourceNotFound.TopicNotExist | The log topic does not exist. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan