tencent cloud

Feedback

DescribePrometheusAlertPolicy

Last updated: 2024-11-26 16:51:52

    1. API Description

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

    This API is used to get the list of v2.0 instance alerting rules.

    A maximum of 20 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: DescribePrometheusAlertPolicy.
    Version Yes String Common Params. The value used for this API: 2018-07-24.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    InstanceId Yes String Instance ID
    Offset No Integer Page offset
    Limit No Integer Number of results per page
    Filters.N No Array of Filter Filter
    Valid values: ID, Name.

    3. Output Parameters

    Parameter Name Type Description
    AlertRules Array of PrometheusAlertPolicyItem Alert details
    Note: This field may return null, indicating that no valid values can be obtained.
    Total Integer Total number
    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 查询实例告警列表

    查询实例告警列表

    Input Example

    POST / HTTP/1.1
    Host: monitor.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribePrometheusAlertPolicy
    <common request parameters>
    
    {
        "InstanceId": "prom-as3d2s1a",
        "Limit": 1,
        "Filters": [
            {
                "Name": "Name",
                "Values": [
                    "alert-test"
                ]
            }
        ],
        "Offset": 0
    }
    

    Output Example

    {
        "Response": {
            "AlertRules": [
                {
                    "Id": "alert-23a6d2ga",
                    "Name": "alert-test",
                    "TemplateId": "temp-as12sf12",
                    "ClusterId": "",
                    "Notification": {
                        "Enabled": true,
                        "Type": "amp",
                        "RepeatInterval": "5m",
                        "TimeRangeStart": "0:00:00",
                        "TimeRangeEnd": "23:59:59",
                        "ReceiverGroups": [
                            "notice-13hs61s2"
                        ],
                        "WebHook": "http://127.0.0.1:9090/alert",
                        "AlertManager": {
                            "ClusterType": "tke",
                            "ClusterId": "cls-a2df21xa",
                            "Url": "http://127.0.0.1:9090"
                        },
                        "PhoneNotifyOrder": [
                            1
                        ],
                        "PhoneCircleTimes": 0,
                        "PhoneInnerInterval": 0,
                        "PhoneCircleInterval": 0,
                        "PhoneArriveNotice": true,
                        "NotifyWay": [
                            "abc"
                        ]
                    },
                    "Rules": [
                        {
                            "Name": "rule-1",
                            "Rule": "up{} != 1",
                            "Labels": [
                                {
                                    "Name": "level",
                                    "Value": "warnning"
                                }
                            ],
                            "Template": "test alert",
                            "For": "5m",
                            "Describe": "test alert",
                            "Annotations": [
                                {
                                    "Name": "creator",
                                    "Value": "programer"
                                }
                            ],
                            "RuleState": 1
                        }
                    ],
                    "UpdatedAt": "2024-07-21 18:10:14"
                }
            ],
            "Total": 1,
            "RequestId": "3f04883c-eda1-4498-b024-d266baec6040"
        }
    }
    

    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.ComponentClientCommon FailedOperation.ComponentClientCommon
    FailedOperation.ComponentClientHttp FailedOperation.ComponentClientHttp
    FailedOperation.ComponentClientUnpack FailedOperation.ComponentClientUnpack
    FailedOperation.DoTRPCTransferFailed DoTRPCTransferFailed
    FailedOperation.KubeClientConf FailedOperation.KubeClientConf
    FailedOperation.KubeCommon FailedOperation.KubeCommon
    InternalError Internal error.
    InternalError.DbRecordNotFound InternalError.DbRecordNotFound
    InternalError.Param InternalError.Param
    InternalError.UnexpectedInternal InternalError.UnexpectedInternal
    InvalidParameter Invalid parameter.
    InvalidParameter.Param InvalidParameter.Param
    InvalidParameter.PromClusterNotFound InvalidParameter.PromClusterNotFound
    InvalidParameter.PromInstanceNotFound InvalidParameter.PromInstanceNotFound
    ResourceNotFound The resource is not found.