All Products
Search
Document Center

CloudMonitor:DescribeAlertLogCount

Last Updated:Jul 26, 2024

Queries the statistics of alert logs.

Operation description

Queries the statistics of alert logs.

This topic provides an example on how to query the statistics of alert logs for 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:DescribeAlertLogCountget
  • 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 AlertLogCount parameter is empty.

Note The interval between the start time (StartTime) and end time (EndTime) must be less than or equal to 15 days. The start time and end time must be specified or left empty at the same time. If you do not specify the start time and end time, 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 AlertLogCount parameter is empty.

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

The dimension 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.
1
PageSizeintegerNo

The number of entries to return on each page. Default value: 10.

10
SearchKeystringNo

The keyword based on which the alert logs to be counted are searched.

test
NamespacestringNo

The namespace of the cloud service.

Note For more information about the namespaces of cloud services, see Appendix 1: Metrics.
acs_ecs_dashboard
GroupIdstringNo

The ID of the application group.

7301****
ProductstringNo

The abbreviation of the service name.

ECS
LevelstringNo

The level and notification method 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 generated not during the effective period.
  • 2: The alert is muted and not triggered in a specified period.
  • 3: The host is restarting.
  • 4: Notifications are not sent for the alert.

When 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 group.

ECS_Group
RuleNamestringNo

The name of the alert rule.

test123
MetricNamestringNo

The name of the metric.

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

The statistical period of alert logs. Unit: minutes.

360
GroupBystringYes

The dimension based on which data is aggregated. This parameter is similar to the Group By clause of SQL statements. 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 group.
  • product,metricName: aggregates data both by cloud service and by metric.
product
SourceTypestringNo

This parameter is deprecated.

None
EventTypestringNo

The type of the alert event. Valid values:

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

The ID of the alert rule.

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

bfae2ca5b4e07d2c7278772e***********

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

Response parameters

ParameterTypeDescriptionExample
object
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.
RequestIdstring

The request ID.

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

Indicates whether the request was successful. Valid values:

  • true
  • false
true
AlertLogCountarray<object>

The statistics of alert logs.

object
Countinteger

The number of alert logs.

1
Logsarray<object>

The details about alert logs.

object
Namestring

The name of the dimension field based on which alert logs are aggregated.

product
Valuestring

The value of the dimension field based on which alert logs are aggregated.

ECS

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "The specified resource is not found.",
  "RequestId": "1C4A3709-BF52-42EE-87B5-7435F0929585",
  "Success": true,
  "AlertLogCount": [
    {
      "Count": 1,
      "Logs": [
        {
          "Name": "product",
          "Value": "ECS"
        }
      ]
    }
  ]
}

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