All Products
Search
Document Center

CloudMonitor:DescribeAlertLogList

Last Updated:Jul 26, 2024

Queries alert logs.

Operation description

You can call the operation to query only the alert logs within the last year.

This topic provides an example to show how to query the alert logs of Elastic Compute Service (ECS) based on the product dimension.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
cms:DescribeAlertLogListget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
StartTimelongNo

The start timestamp of the alert logs to be queried.

Unit: milliseconds.

You can query only the alert logs within the last year. If the query time is longer than one year, the return value of the AlertLogList parameter is empty.

Note The time period between the start time specified by StartTime and the end time specified by EndTime must be less than or equal to 15 days. You must specify StartTime and EndTime at the same time, or leave StartTime and EndTime empty at the same time. If you do not specify this parameter, the alert logs within the last 15 minutes are queried by default.
1609988009694
EndTimelongNo

The end timestamp of the alert logs to be queried.

Unit: milliseconds.

You can query only the alert logs within the last year. If the query time is longer than one year, the return value of the AlertLogList parameter is empty.

Note The time period between the start time specified by StartTime and end time specified by EndTime must be less than or equal to 15 days. You must specify StartTime and EndTime at the same time, or leave StartTime and EndTime empty at the same time. If you do not specify this parameter, the alert logs within the last 15 minutes are queried by default.
1610074409694
PageNumberintegerNo

The page number.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page.

Default value: 10.

10
SearchKeystringNo

The search keyword that is used to query alert logs.

alert
GroupIdstringNo

The ID of the application group.

7301****
NamespacestringNo

The namespace of the cloud service.

Note For information about how to query the namespace of a cloud service, see Appendix 1: Metrics.
acs_ecs_dashboard
ProductstringNo

The abbreviation of the service name.

For information about how to obtain the abbreviation of a cloud service name, see DescribeProductsOfActiveMetricRule .

ECS
LevelstringNo

The severity level and notification methods of the alert. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
P4
SendStatusstringNo

The status of the alert. Valid values:

  • 0: The alert is triggered or cleared.
  • 1: The alert is ineffective.
  • 2: The alert is muted.
  • 3: The host is restarting.
  • 4: No alert notification is sent.

If the value of the SendStatus parameter is 0, the value P4 of the Level parameter indicates a triggered alert and the value OK indicates a cleared alert.

0
ContactGroupstringNo

The alert contact group.

ECS_Group
RuleNamestringNo

The name of the alert rule.

test123
MetricNamestringNo

The metric name.

Note For more information about the metrics of different cloud services, see Appendix 1: Metrics.
IntranetInRate
LastMinstringNo

The statistical period of alert logs. Unit: minutes.

360
GroupBystringNo

The dimensions based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL. Valid values:

  • product: aggregates data by cloud service.
  • level: aggregates data by alert level.
  • groupId: aggregates data by application group.
  • contactGroup: aggregates data by alert contact group.
  • product,metricName: aggregates data both by cloud service and by metric.
product
RuleIdstringNo

The ID of the alert rule.

For information about how to obtain the ID of an alert rule, see DescribeMetricRuleList .

bc369e8_30f87e517ed2fc****
SourceTypestringNo

The type of the alert rule. Valid value: METRIC. This value indicates an alert rule for time series metrics.

METRIC
EventTypestringNo

The type of the alert event. Valid values:

  • TRIGGERED: The alert is triggered.
  • RESOLVED: The alert is resolved.
TRIGGERED

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object

None.

RequestIdstring

The request ID.

1C4A3709-BF52-42EE-87B5-7435F0929585
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Codestring

The HTTP status code.

Note The status code 200 indicates that the request was successful.
200
Messagestring

The error message.

The specified resource is not found.
PageNumberinteger

The page number.

1
PageSizeinteger

The number of entries per page.

10
AlertLogListarray<object>

The queried alert logs.

object
MetricNamestring

The metric name.

cpu_total
EventNamestring

The event name.

IOHang
Productstring

The identifier of the cloud service. Valid values:

  • If the cloud service is provided by Alibaba Cloud, the abbreviation of the service name is returned. Example: ECS.
  • If the cloud service is not provided by Alibaba Cloud, a value in the acs_Service keyword format is returned. Example: acs_networkmonitor.
ECS
BlackListUUIDstring

The ID of the blacklist policy.

8410dbbd-7d30-41c5-94cb-*****
Messagestring

The alert information in a JSON string.

{"alertName":"e47aa0ac-4076-44db-a47d-d1083968****_Availability"}
Namespacestring

The namespace of the cloud service.

acs_ecs_dashboard
LevelChangestring

Indicates whether the alert level was changed. Valid values:

  • P4->OK: The alert level was changed from P4 to OK.
  • P4->P4: The alert level was still P4.
P4->OK
InstanceIdstring

The resource ID.

i-m5e1qg6uo38rztr4****
RuleNamestring

The name of the alert rule.

RuleIdstring

The ID of the alert rule.

d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime
BlackListNamestring

The name of the blacklist policy.

{"id":123,"metricProject":"acs_ecs_dashboard","userId":1736511134389110,"uuid":"8410dbbd-7d30-41c5-94cb-***","name":"alert-***","productCategory":"ecs","instances":[{"instanceId":"host-***"}],"metrics":null,"scopeType":"USER","scopeValue":"","startTime":"0001-01-01T00:00:00Z","endTime":"9999-12-31T23:59:59.999999999+08:00","effectiveTime":null,"isEnable":true,"status":1,"gmtCreate":"2021-11-02T16:35:59+08:00","gmtModified":"2021-11-02T16:35:59+08:00","loadTime":"2021-11-02T16:36:15.213072177+08:00"}
GroupNamestring

The name of the application group.

ECS_Instances
GroupIdstring

The ID of the application group.

7301****
AlertTimestring

The timestamp that was generated when the alert was triggered.

Unit: milliseconds.

1610043776621
InstanceNamestring

The resource name.

portalHost
BlackListDetailstring

The details of the blacklist policy.

BlackListDetail
Levelstring

The alert level and the methods that are used to send alert notifications. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
P4
SendStatusstring

The status of the alert. Valid values:

  • 0: The alert is triggered or cleared.
  • 1: The alert is ineffective.
  • 2: The alert is muted.
  • 3: The host is restarting.
  • 4: No alert notification is sent.

If the value of the SendStatus parameter is 0, the value P4 of the Level parameter indicates a triggered alert and the value OK indicates a cleared alert.

0
ExtendedInfoarray<object>

The extended fields.

object
Namestring

The name of the extended field.

userId
Valuestring

The value of the extended field.

120886317861****
Dimensionsarray<object>

The dimensions of the resource that triggered alerts.

object
Keystring

The key of the dimension.

instanceId
Valuestring

The value of the dimension.

i-m5e1qg6uo38rztr4****
WebhookListarray<object>

The callback URLs.

object
codestring

The status code of the alert callback.

200
urlstring

The callback URL.

https://www.aliyun.com/webhook.html
messagestring

The message returned for the alert callback.

success
DingdingWebhookListarray
string

The webhook URL of the alert contact.

https://oapi.dingtalk.com/robot/send?access_token=b7ff24032da1a5f86659ecda46797e13cc1d4e4da6903d7b014ea1d1488b****
ContactOnCallListarray
string

The phone number of the alert contact that receives alert phone calls.

Note This parameter applies only to the Alibaba Cloud China site (aliyun.com).
1368888****
ContactMailListarray
string

The email address of the alert contact.

username@example.com
ContactGroupsarray
string

The alert contact group.

ECS_Group
ContactALIIWWListarray
string

The TradeManager ID of the alert contact.

Note This parameter applies only to the Alibaba Cloud China site (aliyun.com).
Alice
ContactSMSListarray
string

The phone number of the alert contact that receives alert text messages.

Note This parameter applies only to the Alibaba Cloud China site (aliyun.com).
1368888****
ContactDingListarray
string

The DingTalk chatbot of the alert contact.

CloudMonitor
SendDetailobject

The details about the sending results of alert notifications.

ResultCodestring

Indicates whether the alert notifications are sent.

  • If the alert notifications are sent, the value "success" is returned.
  • If the configuration is invalid, no alert notification is sent and an error code is returned.
success
ChannelResultListarray<object>

The list of sending results that are categorized by notification method.

object
Channelstring

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

  • MAIL: email
  • SMS: text message
  • WEBHOOK: alert callback
  • SLS: Simple Log Service
  • ONCALL: phone call
  • FC: Function Compute
  • MNS: Message Service queue
MAIL
ResultListarray<object>

The sending results of alert notifications.

object
Codestring

The HTTP status code.

  • If the value of the Channel parameter is WEBHOOK, the status code is 200 or 500.
  • If the value of the Channel parameter is MAIL, SMS, SLS, ONCALL, FC, or MNS, this parameter is empty or not returned.
200
RequestIdstring

The request ID returned when CloudMonitor calls another cloud service.

0BDAF8A8-04DC-5F0C-90E4-724D42C4****
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Detailstring

The details of the returned results.

{ }
notifyTargetListarray
string

The list of notification methods.

1270676********
Escalationobject

The alert rule based on which the alert is triggered.

Expressionstring

The description of the alert rule.

Note The content of the alert rule. This parameter indicates the conditions that trigger an alert.
$Average<90
Timesinteger

The consecutive number of times for which the metric value meets the alert condition before an alert is triggered.

1
Levelstring

The alert level and the methods that are used to send alert notifications. Valid values:

  • P4: Alert notifications are sent by using emails and DingTalk chatbots.
  • OK: No alert is generated.
P4
SendResultListarray<object>

The sending results of alert notifications.

object
Keystring

The category of the alert notification method. Valid values:

  • MAIL: email
  • ALIIM: TradeManager
  • SMS: text message
  • CALL: phone call
  • DING: DingTalk chatbot
  • Merged: alert merging
Mail
Valuearray

The notification object corresponding to the alert notification method.

string

The notification object corresponding to the alert notification method.

username@example.com
LogIdstring

The log ID.

7818361[1523]@1671593992[1]

Examples

Sample success responses

JSONformat

{
  "RequestId": "1C4A3709-BF52-42EE-87B5-7435F0929585",
  "Success": true,
  "Code": "200",
  "Message": "The specified resource is not found.",
  "PageNumber": 1,
  "PageSize": 10,
  "AlertLogList": [
    {
      "MetricName": "cpu_total",
      "EventName": "IOHang",
      "Product": "ECS",
      "BlackListUUID": "8410dbbd-7d30-41c5-94cb-*****",
      "Message": "{\"alertName\":\"e47aa0ac-4076-44db-a47d-d1083968****_Availability\"}",
      "Namespace": "acs_ecs_dashboard",
      "LevelChange": "P4->OK",
      "InstanceId": "i-m5e1qg6uo38rztr4****",
      "RuleName": "",
      "RuleId": "d582b9e9-b1c1-4f17-9279-0fe7333a****_ResponseTime",
      "BlackListName": "{\"id\":123,\"metricProject\":\"acs_ecs_dashboard\",\"userId\":1736511134389110,\"uuid\":\"8410dbbd-7d30-41c5-94cb-***\",\"name\":\"alert-***\",\"productCategory\":\"ecs\",\"instances\":[{\"instanceId\":\"host-***\"}],\"metrics\":null,\"scopeType\":\"USER\",\"scopeValue\":\"\",\"startTime\":\"0001-01-01T00:00:00Z\",\"endTime\":\"9999-12-31T23:59:59.999999999+08:00\",\"effectiveTime\":null,\"isEnable\":true,\"status\":1,\"gmtCreate\":\"2021-11-02T16:35:59+08:00\",\"gmtModified\":\"2021-11-02T16:35:59+08:00\",\"loadTime\":\"2021-11-02T16:36:15.213072177+08:00\"}",
      "GroupName": "ECS_Instances",
      "GroupId": "7301****",
      "AlertTime": "1610043776621",
      "InstanceName": "portalHost",
      "BlackListDetail": "BlackListDetail",
      "Level": "P4",
      "SendStatus": "0",
      "ExtendedInfo": [
        {
          "Name": "userId",
          "Value": "120886317861****"
        }
      ],
      "Dimensions": [
        {
          "Key": "instanceId",
          "Value": "i-m5e1qg6uo38rztr4****"
        }
      ],
      "WebhookList": [
        {
          "code": "200",
          "url": "https://www.aliyun.com/webhook.html",
          "message": "success"
        }
      ],
      "DingdingWebhookList": [
        "https://oapi.dingtalk.com/robot/send?access_token=b7ff24032da1a5f86659ecda46797e13cc1d4e4da6903d7b014ea1d1488b****"
      ],
      "ContactOnCallList": [
        "1368888****"
      ],
      "ContactMailList": [
        "username@example.com"
      ],
      "ContactGroups": [
        "ECS_Group"
      ],
      "ContactALIIWWList": [
        "Alice"
      ],
      "ContactSMSList": [
        "1368888****"
      ],
      "ContactDingList": [
        "CloudMonitor"
      ],
      "SendDetail": {
        "ResultCode": "success",
        "ChannelResultList": [
          {
            "Channel": "MAIL",
            "ResultList": [
              {
                "Code": "200",
                "RequestId": "0BDAF8A8-04DC-5F0C-90E4-724D42C4****",
                "Success": true,
                "Detail": "{ }",
                "notifyTargetList": [
                  "1270676********"
                ]
              }
            ]
          }
        ]
      },
      "Escalation": {
        "Expression": "$Average<90",
        "Times": 1,
        "Level": "P4"
      },
      "SendResultList": [
        {
          "Key": "Mail",
          "Value": [
            "username@example.com"
          ]
        }
      ],
      "LogId": "7818361[1523]@1671593992[1]"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400ParameterInvalid%s-
403AccessForbiddenUser not authorized to operate on the specified resource.-
404ResourceNotFoundThe specified resource is not found.The specified resource is not found.
409ResourceConflictConcurrent modification of resources.-
409ResourceExistResources already exist.-
500InternalErrorThe request processing has failed due to some unknown error.-

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

Change history

Change timeSummary of changesOperation
2023-12-07The Error code has changed. The request parameters of the API has changedView Change Details
2023-07-27The Error code has changed. The request parameters of the API has changedView Change Details
2022-09-29The Error code has changed. The response structure of the API has changedView Change Details