tencent cloud

Feedback

DescribeAlarmPolicies

Last updated: 2024-07-08 17:36:11

    1. API Description

    Domain name for API request: monitor.tencentcloudapi.com.

    This API is used to query the list of alarm policies.

    A maximum of 60 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    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: DescribeAlarmPolicies.
    Version Yes String Common Params. The value used for this API: 2018-07-24.
    Region No String Common Params. This parameter is not required.
    Module Yes String Value fixed at "monitor"
    PageNumber No Integer Page number starting from 1. Default value: 1
    PageSize No Integer Number of entries per page. Value range: 1–100. Default value: 20
    PolicyName No String Fuzzy search by policy name
    MonitorTypes.N No Array of String Filter by monitor type. Valid values: MT_QCE (Tencent Cloud service monitoring). If this parameter is left empty, all will be queried by default
    Namespaces.N No Array of String Filter by namespace. For the values of different policy types, please see:
    Policy Type List
    Dimensions No String The alarm object list, which is a JSON string. The outer array corresponds to multiple instances, and the inner array is the dimension of an object. For example, “CVM - Basic Monitor” can be written as:
    [ {"Dimensions": {"unInstanceId": "ins-qr8d555g"}}, {"Dimensions": {"unInstanceId": "ins-qr8d555h"}} ]
    You can also refer to the “Example 2” below.

    For more information on the parameter samples of different Tencent Cloud services, see Product Policy Type and Dimension Information.

    Note: If 1 is passed in for NeedCorrespondence, the relationship between a policy and an instance needs to be returned. You can pass in up to 20 alarm object dimensions to avoid request timeout.
    ReceiverUids.N No Array of Integer Search by recipient. You can get the user list with the API ListUsers in “Cloud Access Management” or query the sub-user information with the API GetUser. The Uid field in the returned result should be entered here.
    ReceiverGroups.N No Array of Integer Search by recipient group. You can get the user group list with the API ListGroups in “Cloud Access Management” or query the user group list where a sub-user is in with the API ListGroupsForUser. The GroupId field in the returned result should be entered here.
    PolicyType.N No Array of String Filter by default policy. Valid values: DEFAULT (display default policy), NOT_DEFAULT (display non-default policies). If this parameter is left empty, all policies will be displayed
    Field No String Sort by field. For example, to sort by the last modification time, use Field: "UpdateTime".
    Order No String Sort order. Valid values: ASC (ascending), DESC (descending)
    ProjectIds.N No Array of Integer ID array of the policy project, which can be viewed on the following page:
    Project Management
    NoticeIds.N No Array of String List of the notification template IDs, which can be obtained by querying the notification template list.
    It can be queried with the API DescribeAlarmNotices.
    RuleTypes.N No Array of String Filter by trigger condition. Valid values: STATIC (display policies with static threshold), DYNAMIC (display policies with dynamic threshold). If this parameter is left empty, all policies will be displayed
    Enable.N No Array of Integer Filter by alarm status. Valid values: [1]: enabled; [0]: disabled; [0, 1]: all
    NotBindingNoticeRule No Integer If 1 is passed in, alarm policies with no notification rules configured are queried. If it is left empty or other values are passed in, all alarm policies are queried.
    InstanceGroupId No Integer Instance group ID.
    NeedCorrespondence No Integer Whether the relationship between a policy and the input parameter filter dimension is required. 1: Yes. 0: No. Default value: 0.
    TriggerTasks.N No Array of AlarmPolicyTriggerTask Filter alarm policy by triggered task (such as auto scaling task). Up to 10 tasks can be specified.
    OneClickPolicyType.N No Array of String Filter by quick alarm policy. If this parameter is left empty, all policies are displayed. ONECLICK: Display quick alarm policies; NOT_ONECLICK: Display non-quick alarm policies.
    NotBindAll No Integer Whether the returned result needs to filter policies associated with all objects. Valid values: 1 (Yes), 0 (No).
    NotInstanceGroup No Integer Whether the returned result needs to filter policies associated with instance groups. Valid values: 1 (Yes), 0 (No).
    Tags.N No Array of Tag Filter policies by tag
    PromInsId No String ID of the TencentCloud Managed Service for Prometheus instance, which is used for customizing a metric policy.
    ReceiverOnCallFormIDs.N No Array of String Search by schedule

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer Total number of policies
    Policies Array of AlarmPolicy Policy array
    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.

    4. Example

    Example1 Searching for policies by recipient group

    This example shows you how to search for policies by recipient group.

    Input Example

    POST / HTTP/1.1
    Host: monitor.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeAlarmPolicies
    <Common request parameters>
    
    {
        "Module": "monitor",
        "PageSize": 10,
        "PageNumber": 1
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 0,
            "Policies": [
                {
                    "PolicyId": "abc",
                    "PolicyName": "abc",
                    "Remark": "abc",
                    "MonitorType": "abc",
                    "Enable": 0,
                    "UseSum": 0,
                    "ProjectId": 0,
                    "ProjectName": "abc",
                    "Namespace": "abc",
                    "ConditionTemplateId": "abc",
                    "Condition": {
                        "IsUnionRule": 0,
                        "Rules": [
                            {
                                "MetricName": "abc",
                                "Period": 0,
                                "Operator": "abc",
                                "Value": "abc",
                                "ContinuePeriod": 0,
                                "NoticeFrequency": 0,
                                "IsPowerNotice": 0,
                                "Filter": {
                                    "Type": "abc",
                                    "Dimensions": "abc"
                                },
                                "Description": "abc",
                                "Unit": "abc",
                                "RuleType": "abc",
                                "IsAdvanced": 0,
                                "IsOpen": 0,
                                "ProductId": "abc",
                                "ValueMax": 0,
                                "ValueMin": 0,
                                "HierarchicalValue": {
                                    "Remind": "abc",
                                    "Warn": "abc",
                                    "Serious": "abc"
                                }
                            }
                        ],
                        "ComplexExpression": "abc"
                    },
                    "EventCondition": {
                        "Rules": [
                            {
                                "MetricName": "abc",
                                "Period": 0,
                                "Operator": "abc",
                                "Value": "abc",
                                "ContinuePeriod": 0,
                                "NoticeFrequency": 0,
                                "IsPowerNotice": 0,
                                "Filter": {
                                    "Type": "abc",
                                    "Dimensions": "abc"
                                },
                                "Description": "abc",
                                "Unit": "abc",
                                "RuleType": "abc",
                                "IsAdvanced": 0,
                                "IsOpen": 0,
                                "ProductId": "abc",
                                "ValueMax": 0,
                                "ValueMin": 0,
                                "HierarchicalValue": {
                                    "Remind": "abc",
                                    "Warn": "abc",
                                    "Serious": "abc"
                                }
                            }
                        ]
                    },
                    "NoticeIds": [
                        "abc"
                    ],
                    "Notices": [
                        {
                            "Id": "abc",
                            "Name": "abc",
                            "UpdatedAt": "abc",
                            "UpdatedBy": "abc",
                            "NoticeType": "abc",
                            "UserNotices": [
                                {
                                    "ReceiverType": "abc",
                                    "UserIds": [
                                        0
                                    ],
                                    "GroupIds": [
                                        0
                                    ],
                                    "StartTime": 0,
                                    "EndTime": 0,
                                    "NoticeWay": [
                                        "abc"
                                    ],
                                    "PhoneOrder": [
                                        0
                                    ],
                                    "PhoneCircleTimes": 0,
                                    "PhoneInnerInterval": 0,
                                    "PhoneCircleInterval": 0,
                                    "NeedPhoneArriveNotice": 0,
                                    "PhoneCallType": "abc",
                                    "Weekday": [
                                        0
                                    ],
                                    "OnCallFormIDs": [
                                        "abc"
                                    ]
                                }
                            ],
                            "URLNotices": [
                                {
                                    "URL": "abc",
                                    "IsValid": 0,
                                    "ValidationCode": "abc",
                                    "StartTime": 0,
                                    "EndTime": 0,
                                    "Weekday": [
                                        0
                                    ]
                                }
                            ],
                            "IsPreset": 0,
                            "NoticeLanguage": "abc",
                            "PolicyIds": [
                                "abc"
                            ],
                            "AMPConsumerId": "abc",
                            "CLSNotices": [
                                {
                                    "Enable": 0,
                                    "Region": "abc",
                                    "LogSetId": "abc",
                                    "TopicId": "abc"
                                }
                            ],
                            "Tags": [
                                {
                                    "Key": "abc",
                                    "Value": "abc"
                                }
                            ]
                        }
                    ],
                    "TriggerTasks": [
                        {
                            "Type": "abc",
                            "TaskConfig": "abc"
                        }
                    ],
                    "ConditionsTemp": {
                        "TemplateName": "abc",
                        "Condition": {
                            "IsUnionRule": 0,
                            "Rules": [
                                {
                                    "MetricName": "abc",
                                    "Period": 0,
                                    "Operator": "abc",
                                    "Value": "abc",
                                    "ContinuePeriod": 0,
                                    "NoticeFrequency": 0,
                                    "IsPowerNotice": 0,
                                    "Filter": {
                                        "Type": "abc",
                                        "Dimensions": "abc"
                                    },
                                    "Description": "abc",
                                    "Unit": "abc",
                                    "RuleType": "abc",
                                    "IsAdvanced": 0,
                                    "IsOpen": 0,
                                    "ProductId": "abc",
                                    "ValueMax": 0,
                                    "ValueMin": 0,
                                    "HierarchicalValue": {
                                        "Remind": "abc",
                                        "Warn": "abc",
                                        "Serious": "abc"
                                    }
                                }
                            ],
                            "ComplexExpression": "abc"
                        },
                        "EventCondition": {}
                    },
                    "LastEditUin": "abc",
                    "UpdateTime": 0,
                    "InsertTime": 0,
                    "Region": [
                        "abc"
                    ],
                    "NamespaceShowName": "abc",
                    "IsDefault": 0,
                    "CanSetDefault": 0,
                    "InstanceGroupId": 0,
                    "InstanceSum": 0,
                    "InstanceGroupName": "abc",
                    "RuleType": "abc",
                    "OriginId": "abc",
                    "TagInstances": [
                        {
                            "Key": "abc",
                            "Value": "abc",
                            "InstanceSum": 0,
                            "ServiceType": "abc",
                            "RegionId": 0,
                            "BindingStatus": 0,
                            "TagStatus": 0
                        }
                    ],
                    "FilterDimensionsParam": "abc",
                    "IsOneClick": 0,
                    "OneClickStatus": 0,
                    "AdvancedMetricNumber": 0,
                    "IsBindAll": 0,
                    "Tags": [
                        {
                            "Key": "abc",
                            "Value": "abc"
                        }
                    ]
                }
            ],
            "RequestId": "abc"
        }
    }
    

    Example2 Searching for an alarm policy associated with a CVM

    This example shows you how to filter policies by instance. You need to specify the monitoring/policy type and enter the dimension information of an instance. In this example, we will filter policies by searching for two CVMs with the IDs ins-qr8d555g and ins-qr8d555h, respectively.

    MonitorTypes is specified as MT_QCE.

    Namespaces is specified as cvm_device.

    The JSON string specified for Dimensions is

    [
        {
            "Dimensions": {
                "unInstanceId": "ins-qr8d555g"
            }
        },
         {
            "Dimensions": {
                "unInstanceId": "ins-qr8d555h"
            }
        }
    ]
    

    For more information on the sample parameters of different Tencent Cloud services, see Product Policy Type and Dimension Information.

    Input Example

    POST / HTTP/1.1
    Host: monitor.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeAlarmPolicies
    <Common request parameters>
    
    {
        "Module": "monitor",
        "PageSize": 10,
        "PageNumber": 1,
        "MonitorTypes": [
            "MT_QCE"
        ],
        "Namespaces": [
            "cvm_device"
        ],
        "Dimensions": "[{\"Dimensions\": { \"unInstanceId\": \"ins-qr8d555g\"}},{ \"Dimensions\": { \"unInstanceId\": \"ins-qr8d555h\"}}]"
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 0,
            "Policies": [
                {
                    "PolicyId": "abc",
                    "PolicyName": "abc",
                    "Remark": "abc",
                    "MonitorType": "abc",
                    "Enable": 0,
                    "UseSum": 0,
                    "ProjectId": 0,
                    "ProjectName": "abc",
                    "Namespace": "abc",
                    "ConditionTemplateId": "abc",
                    "Condition": {
                        "IsUnionRule": 0,
                        "Rules": [
                            {
                                "MetricName": "abc",
                                "Period": 0,
                                "Operator": "abc",
                                "Value": "abc",
                                "ContinuePeriod": 0,
                                "NoticeFrequency": 0,
                                "IsPowerNotice": 0,
                                "Filter": {
                                    "Type": "abc",
                                    "Dimensions": "abc"
                                },
                                "Description": "abc",
                                "Unit": "abc",
                                "RuleType": "abc",
                                "IsAdvanced": 0,
                                "IsOpen": 0,
                                "ProductId": "abc",
                                "ValueMax": 0,
                                "ValueMin": 0,
                                "HierarchicalValue": {
                                    "Remind": "abc",
                                    "Warn": "abc",
                                    "Serious": "abc"
                                }
                            }
                        ],
                        "ComplexExpression": "abc"
                    },
                    "EventCondition": {
                        "Rules": [
                            {
                                "MetricName": "abc",
                                "Period": 0,
                                "Operator": "abc",
                                "Value": "abc",
                                "ContinuePeriod": 0,
                                "NoticeFrequency": 0,
                                "IsPowerNotice": 0,
                                "Filter": {
                                    "Type": "abc",
                                    "Dimensions": "abc"
                                },
                                "Description": "abc",
                                "Unit": "abc",
                                "RuleType": "abc",
                                "IsAdvanced": 0,
                                "IsOpen": 0,
                                "ProductId": "abc",
                                "ValueMax": 0,
                                "ValueMin": 0,
                                "HierarchicalValue": {
                                    "Remind": "abc",
                                    "Warn": "abc",
                                    "Serious": "abc"
                                }
                            }
                        ]
                    },
                    "NoticeIds": [
                        "abc"
                    ],
                    "Notices": [
                        {
                            "Id": "abc",
                            "Name": "abc",
                            "UpdatedAt": "abc",
                            "UpdatedBy": "abc",
                            "NoticeType": "abc",
                            "UserNotices": [
                                {
                                    "ReceiverType": "abc",
                                    "UserIds": [
                                        0
                                    ],
                                    "GroupIds": [
                                        0
                                    ],
                                    "StartTime": 0,
                                    "EndTime": 0,
                                    "NoticeWay": [
                                        "abc"
                                    ],
                                    "PhoneOrder": [
                                        0
                                    ],
                                    "PhoneCircleTimes": 0,
                                    "PhoneInnerInterval": 0,
                                    "PhoneCircleInterval": 0,
                                    "NeedPhoneArriveNotice": 0,
                                    "PhoneCallType": "abc",
                                    "Weekday": [
                                        0
                                    ],
                                    "OnCallFormIDs": [
                                        "abc"
                                    ]
                                }
                            ],
                            "URLNotices": [
                                {
                                    "URL": "abc",
                                    "IsValid": 0,
                                    "ValidationCode": "abc",
                                    "StartTime": 0,
                                    "EndTime": 0,
                                    "Weekday": [
                                        0
                                    ]
                                }
                            ],
                            "IsPreset": 0,
                            "NoticeLanguage": "abc",
                            "PolicyIds": [
                                "abc"
                            ],
                            "AMPConsumerId": "abc",
                            "CLSNotices": [
                                {
                                    "Enable": 0,
                                    "Region": "abc",
                                    "LogSetId": "abc",
                                    "TopicId": "abc"
                                }
                            ],
                            "Tags": [
                                {
                                    "Key": "abc",
                                    "Value": "abc"
                                }
                            ]
                        }
                    ],
                    "TriggerTasks": [
                        {
                            "Type": "abc",
                            "TaskConfig": "abc"
                        }
                    ],
                    "ConditionsTemp": {
                        "TemplateName": "abc",
                        "Condition": {
                            "IsUnionRule": 0,
                            "Rules": [
                                {
                                    "MetricName": "abc",
                                    "Period": 0,
                                    "Operator": "abc",
                                    "Value": "abc",
                                    "ContinuePeriod": 0,
                                    "NoticeFrequency": 0,
                                    "IsPowerNotice": 0,
                                    "Filter": {
                                        "Type": "abc",
                                        "Dimensions": "abc"
                                    },
                                    "Description": "abc",
                                    "Unit": "abc",
                                    "RuleType": "abc",
                                    "IsAdvanced": 0,
                                    "IsOpen": 0,
                                    "ProductId": "abc",
                                    "ValueMax": 0,
                                    "ValueMin": 0,
                                    "HierarchicalValue": {
                                        "Remind": "abc",
                                        "Warn": "abc",
                                        "Serious": "abc"
                                    }
                                }
                            ],
                            "ComplexExpression": "abc"
                        },
                        "EventCondition": {}
                    },
                    "LastEditUin": "abc",
                    "UpdateTime": 0,
                    "InsertTime": 0,
                    "Region": [
                        "abc"
                    ],
                    "NamespaceShowName": "abc",
                    "IsDefault": 0,
                    "CanSetDefault": 0,
                    "InstanceGroupId": 0,
                    "InstanceSum": 0,
                    "InstanceGroupName": "abc",
                    "RuleType": "abc",
                    "OriginId": "abc",
                    "TagInstances": [
                        {
                            "Key": "abc",
                            "Value": "abc",
                            "InstanceSum": 0,
                            "ServiceType": "abc",
                            "RegionId": 0,
                            "BindingStatus": 0,
                            "TagStatus": 0
                        }
                    ],
                    "FilterDimensionsParam": "abc",
                    "IsOneClick": 0,
                    "OneClickStatus": 0,
                    "AdvancedMetricNumber": 0,
                    "IsBindAll": 0,
                    "Tags": [
                        {
                            "Key": "abc",
                            "Value": "abc"
                        }
                    ]
                }
            ],
            "RequestId": "abc"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    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.
    FailedOperation.DoHTTPTransferFailed Backend service timed out.
    InternalError Internal error.
    UnsupportedOperation Unsupported operation.