Domain name for API request: cls.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 | No | String | Common Params. This parameter is not required for this API. |
Name | Yes | String | Alarm policy name |
AlarmTargets.N | Yes | Array of AlarmTarget | Monitoring object list |
MonitorTime | Yes | MonitorTime | Monitoring task running time point |
TriggerCount | Yes | Integer | Alarm persistence cycle. An alarm will be triggered only after the corresponding trigger condition is met for the number of times specified by TriggerCount . Value range: 1–10. |
AlarmPeriod | Yes | Integer | Alarm repeat interval in minutes. The value range is 0~1440. |
AlarmNoticeIds.N | Yes | Array of String | List of associated alarm notification templates |
Condition | No | String | Trigger ConditionNote:- Condition and AlarmLevel are one set of configurations, MultiConditions is another set of configurations. The two sets of configurations are mutually exclusive. |
AlarmLevel | No | Integer | Alarm Level0: Warning (Warn); 1: Reminder (Info); 2: Urgent (Critical). Note:- If not specified, the default is 0. - Condition and AlarmLevel are one set of configurations, MultiConditions is another set of configurations. The two sets of configurations are mutually exclusive. |
MultiConditions.N | No | Array of MultiCondition | Multiple trigger conditions Note:- Condition and AlarmLevel form one set of configurations, while MultiConditions form another set of configurations, and the two sets are mutually exclusive. |
Status | No | Boolean | Whether to enable the alarm policyThe default value is true |
Enable | No | Boolean | This parameter has been deprecated, please use the Status parameter to control whether to enable the alarm policy. |
MessageTemplate | No | String | Custom alarm content |
CallBack | No | CallBackInfo | Custom callback |
Analysis.N | No | Array of AnalysisDimensional | Multi-Dimensional analysis |
GroupTriggerStatus | No | Boolean | Group trigger status. Default value is false |
GroupTriggerCondition.N | No | Array of String | Grouping Trigger Conditions. |
Tags.N | No | Array of Tag | Tag description list, by specifying this parameter, you can simultaneously bind Tag to the corresponding alarm policy.Supports up to 10 Tag key-value pairs, and the pairs must be unique. |
MonitorObjectType | No | Integer | Monitored Object Type. 0: common monitoring objects for execution statements; 1: separately selected monitoring objects for each execution statement.If not specified, the default value is 0.When the value is 1, the number of AlarmTargets Elements (XML) cannot exceed 10, and the Numbers in AlarmTargets must be continuous positive integers starting from 1, without duplication. |
Classifications.N | No | Array of AlarmClassification | Alarms additional classification information listThe number of Classifications elements cannot exceed 20.The Key of Classifications element must not be empty and duplicated, and its length cannot exceed 50 characters, complying with the regular expression ^a-z$.The Value length of Classifications element cannot exceed 200 characters. |
Parameter Name | Type | Description |
---|---|---|
AlarmId | String | Alarm 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. |
This example shows you how to create an alarm policy.
POST / HTTP/1.1
Host: cls.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAlarm
<Common request parameters>
{
"AlarmNoticeIds": [
"notice-b02af159-f67b-44c3-877c-a55343f874c3"
],
"Name": "test",
"TriggerCount": 1,
"AlarmPeriod": 0,
"MonitorTime": {
"Type": "Period",
"Time": 10
},
"AlarmTargets": [
{
"TopicId": "be3d88bb-a9cb-4d29-b697-0fcfbfd601ef",
"Number": 1,
"Query": "* | select count(*) as count",
"EndTimeOffset": 0,
"StartTimeOffset": 0,
"LogsetId": "fe3d45bb-a9cb-4d29-b697-0fcfbfd601ef"
}
],
"Condition": "$1.count > 10"
}
{
"Response": {
"AlarmId": "alarm-479dec34-4a59-11eb-b378-0242ac130002",
"RequestId": "6ef60bec-0242-43af-bb20-270359fb54a7"
}
}
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. |
Was this page helpful?