ListAlertHistories

Updated at:

Performs a paged query by paging to retrieve the monitoring alert history records in CloudMonitor 2.0.

Operation description

Performs a paged query by paging to retrieve the monitoring alert history records in CloudMonitor 2.0. You can filter the records by multiple dimensions such as alert rule, alert status, alert level, alert object, workspace, time range, label, notification recipient, observed object type, and data source type. You can also use the structured filter parameter to implement more flexible combined queries.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cms:ListAlertHistories

list

*AlertHistory

acs:cms:{#regionId}:{#accountId}:alerthistory/*

None None

Request syntax

GET /alertHistories HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

bizSource

string

No

The business source of the alert history. For example, managed_service_for_prometheus indicates the managed type of the Prometheus integration center. Default value: empty. Leave this parameter empty if you are unsure about the value.

managed_service_for_prometheus

pageSize

integer

No

The number of alert history records to return on each page during paging for a paged query. Default value: 10.

10

pageNumber

integer

No

The page number for paging in a paged query. Default value: 1.

1

alertRuleId

string

No

The unique identifier of the alert rule used to filter the history records of a specific alert rule. Pass the ruleUuid of the alert rule.

mig_prom_v2_11308451

alertHistoryId

string

No

The unique identifier of an alert history record, which is the transId.

lme6hk5qih5o769m379jjuo5i1

displayNameKeyWord

string

No

The keyword used for fuzzy match filtering based on the display name of the alert rule.

keyword

instanceKey

string

No

The unique key value used to identify the alert object instance, which is the instanceKey.

entity/apm/apm.service/6dc9e46fda6d012537b48c3250ff806b

maxLevel

string

No

The highest alert level reached during the alert duration. Valid values: CRITICAL, WARN, and INFO.

CRITICAL

latestLevel

string

No

The level of the most recent alert during the alert duration. Valid values: CRITICAL, WARN, and INFO.

CRITICAL

workspace

string

No

The identifier of the workspace to which the alert history belongs. If you do not specify this parameter, the default workspace is used.

default-cms--cn-hangzhou

labelFilter AlertRuleLabelFilter

No

The filter condition for rule labels. The value is a JSON-formatted string that supports filtering by label key-value pairs.

notificationFilter AlertRuleNotificationFilter

No

The filter used to filter alert rules that contain specific notification recipients. Only rules that contain at least one notification recipient specified in notifyTargets are returned in the result list.

nextToken

string

No

The paging token used to query the next page. This parameter is not supported. Use pageSize and pageNumber for a paged query.

2-ba4d-4b9f-aa24-dcb067a30f1c

maxResults

integer

No

The maximum number of results to return on each page during paging for a paged query. This parameter is not supported. Use pageSize and pageNumber for a paged query.

30

status

string

No

The current status of the alert history. Valid values: OK and ALARM.

ALARM

startTimeFrom

integer

No

The start timestamp of the time range for the alert start time. The value is a UNIX timestamp in milliseconds. If you do not specify this parameter, the default value is the timestamp 30 days ago.

1739866071668

startTimeTo

integer

No

The end timestamp of the time range for the alert start time. The value is a UNIX timestamp in milliseconds. If you do not specify this parameter, the default value is the current timestamp.

1739866071668

partitionKey

string

No

The key value used for data partitioning. You do not need to specify this parameter in most cases.

cn-hangzhou

observeResourceType

string

No

The type of the observed object, such as PROMETHEUS, APM, RUM, and cms_basic.

PROMETHEUS

observeResourceGlobalScope

boolean

No

Specifies whether the observed object is in the global scope.

false

observeResourceInstanceId

string

No

The resource instance ID used to filter the alert history.

i-bp1234567890abcdef

migrationStatus

integer

No

The migration status of the alert history.

0

observeResourceDomain

string

No

The domain of the observed object.

acs

cmsNamespace

string

No

The namespace of CloudMonitor, such as acs_rds_dashboard and acs_ecs_dashboard.

acs_rds_dashboard

cmsProductCategory

string

No

The product category of CloudMonitor.

rds

observeRelationType

string

No

The relation type of the observed object, such as GROUP, INSTANCE, and TAG.

INSTANCE

Response elements

Element

Type

Description

Example

object

Schema of Response

data

array<object>

The list of alert history records that match the query conditions.

[{"alertHistoryId":"ah_123456","alertRuleId":"rule_789","status":"ALARM","startTime":1704067200000}]

array<object>

The alert history record.

alertHistoryId

string

The unique identifier of the alert history record.

u1oe4i7c197uucfmvscum4u797

alertRuleId

string

The unique identifier of the alert rule that generated the alert history record.

51d0da46-bb65-4a14-8d65-de73f41e495f

annotations

object

The snapshot of the annotations of the alert rule, stored as key-value pairs and copied from the rule when the alert is triggered.

{"_cms_alert_explore_url":"https://sls.console.aliyun.com/..."}

string

The value of the annotation.

Node instance {{ $tags.instanceId }}, current memory usage is {{ printf \"%.2f\" $value }}%.

bizSource

string

The business source.

managed_service_for_prometheus

count

integer

The cumulative number of alerts (alert events) during the alert duration.

200

endTime

integer

The end time (recovery time) of the alert. This field has a value only when the alert history record enters the OK state. The value is a UNIX timestamp in milliseconds.

1740535517000

gmtCreate

integer

The creation time of the alert history record. The value is a UNIX timestamp in milliseconds.

1751608363000

gmtModified

integer

The last modification time of the alert history record. The value is a UNIX timestamp in milliseconds.

1751608363000

instanceDetail

object

The detailed information of the alert object, stored as key-value pairs.

{"datasourceInfo":{"type":"SLS_MULTI_DS"}}

string

The value of the alert object detail.

{"instanceId": "i-xxxxxx", "ip": "192.168.1.1"}

instanceKey

string

The unique key value used to identify the alert object instance, which is the instanceKey.

entity/apm/apm.service/6dc9e46fda6d012537b48c3250ff806b

labels

object

The snapshot of the labels of the alert rule, stored as key-value pairs and copied from the rule when the alert is triggered.

{"_cms_rule_id":"42c0f464-a3b0-4c4b-b426-6242289244f8","tenant_id":"mygt"}

string

The value of the label.

myLabelValue

latestLevel

string

The level of the most recent alert during the alert duration, such as CRITICAL, WARN, or INFO.

CRITICAL

maxLevel

string

The highest alert level reached during the alert duration.

CRITICAL

regionId

string

The ID of the region to which the alert history record belongs.

cn-hangzhou

ruleDisplayName

string

The display name of the corresponding rule.

myTestRule

send AlertRuleSend

The notification sending configuration information corresponding to the alert history record.

{"notification":{"contacts":["ops-team"],"silenceTime":3600}}

startTime

integer

The start time of the alert history record. The value is a UNIX timestamp in milliseconds.

1751508233000

status

string

The current alert status of the rule. Valid values: OK (recovered) and ALARM (alerting).

ALARM

workspace

string

The identifier of the workspace to which the alert history record belongs.

default-cms--cn-hangzhou

message

string

The content of the latest alert message.

The number of zombie child processes of the process {{$tags.comm}} running on instance {{$tags.instanceId}} is greater than 128

observeResourceType

string

The type of the observed object, such as PROMETHEUS, APM, RUM, or cms_basic. This value is copied from the rule upon creation.

PROMETHEUS

observeResourceGlobalScope

boolean

Indicates whether the observed object is in the global scope. This value is copied from the rule upon creation.

false

observeResourceList

string

The serialized string of the observed object list. This value is copied from the rule upon creation.

[{"resourceId":"i-bp1234567890abcdef","resourceType":"ACS::ECS::Instance"}]

maxResults

integer

The maximum number of entries to return.

10

nextToken

string

The pagination token.

2-ba4d-4b9f-aa24-dcb067a30f1c

pageNumber

integer

The page number. Default value: 1.

1

pageSize

integer

The number of entries per page.

10

requestId

string

The unique identifier of the request.

264C3E89-XXXX-XXXX-XXXX-CE9C2196C7DC

totalCount

integer

The total number of alert history records that match the query conditions.

81

Examples

Success response

JSON format

{
  "data": [
    {
      "alertHistoryId": "u1oe4i7c197uucfmvscum4u797",
      "alertRuleId": "51d0da46-bb65-4a14-8d65-de73f41e495f",
      "annotations": {
        "key": "Node instance {{ $tags.instanceId }}, current memory usage is  {{ printf \\\"%.2f\\\" $value }}%."
      },
      "bizSource": "managed_service_for_prometheus",
      "count": 200,
      "endTime": 1740535517000,
      "gmtCreate": 1751608363000,
      "gmtModified": 1751608363000,
      "instanceDetail": {
        "key": "{\"instanceId\": \"i-xxxxxx\", \"ip\": \"192.168.1.1\"}"
      },
      "instanceKey": "entity/apm/apm.service/6dc9e46fda6d012537b48c3250ff806b",
      "labels": {
        "key": "myLabelValue"
      },
      "latestLevel": "CRITICAL",
      "maxLevel": "CRITICAL",
      "regionId": "cn-hangzhou",
      "ruleDisplayName": "myTestRule",
      "send": {
        "action": {
          "actions": [
            "myTestAction"
          ]
        },
        "notification": {
          "contacts": [
            "myContactId"
          ],
          "customWebhooks": [
            "myCustomWebhookId"
          ],
          "dingCoolAppWebhooks": [
            "myDingCoolAppWebhookId"
          ],
          "dingWebhooks": [
            "myDingWebhookId"
          ],
          "fsWebhooks": [
            "myFsWebhookId"
          ],
          "groups": [
            "myContactGroupId"
          ],
          "notifyTime": {
            "dayOfWeek": [
              1
            ],
            "endTime": "23:00",
            "gmtOffset": "+0800",
            "startTime": "09:00"
          },
          "qwencloudContacts": {
            "key": {
              "key": false
            }
          },
          "sendOk": false,
          "severityNotifications": {
            "key": {
              "receivers": [
                {
                  "channels": [
                    "SMS"
                  ],
                  "identifiers": [
                    "TEST"
                  ],
                  "targetType": "CONTACT"
                }
              ],
              "sendRecoverNotification": true
            }
          },
          "silenceTime": 86400,
          "slackWebhooks": [
            "mySlackWebhookId"
          ],
          "wxWebhooks": [
            "myWxWebhookId"
          ]
        },
        "notifyStrategies": [
          "[\"trigger\", \"recovery\"]"
        ],
        "rcaConfig": {
          "digitalEmployeeName": "O&M Assistant",
          "enableRca": false
        },
        "sendToArms": true
      },
      "startTime": 1751508233000,
      "status": "ALARM",
      "workspace": "default-cms--cn-hangzhou",
      "message": "The number of zombie child processes of the process {{$tags.comm}} running on the instance {{$tags.instanceId}} is greater than 128",
      "observeResourceType": "PROMETHEUS",
      "observeResourceGlobalScope": false,
      "observeResourceList": "[{\"resourceId\":\"i-bp1234567890abcdef\",\"resourceType\":\"ACS::ECS::Instance\"}]"
    }
  ],
  "maxResults": 10,
  "nextToken": "2-ba4d-4b9f-aa24-dcb067a30f1c",
  "pageNumber": 1,
  "pageSize": 10,
  "requestId": "264C3E89-XXXX-XXXX-XXXX-CE9C2196C7DC",
  "totalCount": 81
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter %s is missing or invalid. The parameter %s is missing or invalid.
400 ParameterInvalid The parameter is missing or invalid. %s The parameter is missing or invalid.
500 InternalUnknownError The request processing has failed due to some unknown error. A service runtime error occurred.
403 Forbidden You are not authorized to operate the specified resource. No permission, please use RAM to authorize
404 ResourceNotFound The specified resource is not found. The specified resource is not found.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.