All Products
Search
Document Center

Application Real-Time Monitoring Service:DescribePrometheusAlertRule

Last Updated:Nov 05, 2024

Queries the details about an alert rule for a Prometheus instance.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
arms:DescribePrometheusAlertRuleget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
AlertIdlongYes

The ID of the alert rule. You can call the ListPrometheusAlertRules operation to query the ID of the alert rule.

3888704
ClusterIdstringNo

The ID of the Prometheus instance.

cc7a37ee31aea4ed1a059eff8034b****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

9FEA6D00-317F-45E3-9004-7FB8B0B7****
PrometheusAlertRuleobject

The returned struct.

Statusinteger

Indicates whether the alert rule is enabled. Valid values:

  • 1: The alert rule is enabled.
  • 0: The alert rule is disabled.
1
Typestring

The type of the alert rule.

Kubernetes component alert
NotifyTypestring

The method of that is used to send alert notifications. Valid values:

  • ALERT_MANAGER: Alert notifications are sent by Operation Center.
  • DISPATCH_RULE: Alert notifications are sent based on the specified notification policy.
ALERT_MANAGER
Expressionstring

The expression of the alert rule.

100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \"pod_name\", \"$1\", \"pod\", \"(.*)\")) by (pod_name))>75
Messagestring

The alert message. Tags can be referenced in the {{$labels.xxx}} format.

The CPU utilization of ${{$labels.pod_name}} has exceeded 80%. Current value: {{$value}}%
Durationstring

The duration of the alert. Valid values: 1 to 1440. Unit: minutes.

1m
DispatchRuleIdlong

The ID of the notification policy. This parameter is returned if the NotifyType parameter is set to DISPATCH_RULE.

10282
AlertNamestring

The name of the alert rule.

Prometheus_Alert
AlertIdlong

The ID of the alert rule.

3888704
ClusterIdstring

The ID of the cluster.

c0bad479465464e1d8c1e641b0afb****
Labelsarray<object>

The tags of the alert rule.

Labelobject
Namestring

The name of the tag.

severity
Valuestring

The value of the tag.

critical
Annotationsarray<object>

The annotations of the alert rule.

Annotationobject
Namestring

The name of the annotation.

message
Valuestring

The value of the annotation.

The CPU utilization of ${{$labels.pod_name}} has exceeded 80%. Current value: {{$value}}%
Codelong

The HTTP status code. The status code 200 indicates that the request was successful.

200
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
True
Messagestring

The returned message.

success

Examples

Sample success responses

JSONformat

{
  "RequestId": "9FEA6D00-317F-45E3-9004-7FB8B0B7****",
  "PrometheusAlertRule": {
    "Status": 1,
    "Type": "Kubernetes component alert\n",
    "NotifyType": "ALERT_MANAGER",
    "Expression": "100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \\\"pod_name\\\", \\\"$1\\\", \\\"pod\\\", \\\"(.*)\\\")) by (pod_name))>75",
    "Message": "The CPU utilization of ${{$labels.pod_name}} has exceeded 80%. Current value: {{$value}}%\n",
    "Duration": "1m",
    "DispatchRuleId": 10282,
    "AlertName": "Prometheus_Alert",
    "AlertId": 3888704,
    "ClusterId": "c0bad479465464e1d8c1e641b0afb****",
    "Labels": [
      {
        "Name": "severity",
        "Value": "critical"
      }
    ],
    "Annotations": [
      {
        "Name": "message",
        "Value": "The CPU utilization of ${{$labels.pod_name}} has exceeded 80%. Current value: {{$value}}%\n"
      }
    ]
  },
  "Code": 200,
  "Success": true,
  "Message": "success"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-31API Description Update. The response structure of the API has changedView Change Details
2023-07-14The request parameters of the API has changedView Change Details