All Products
Search
Document Center

CloudMonitor:DescribeAlertLogHistogram

Last Updated:Jul 26, 2024

Queries the number of alert logs that are generated during each interval within a period of time.

Operation description

This topic provides an example on how to query the number 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:DescribeAlertLogHistogramget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
StartTimelongNo

The start timestamp of the alert logs to be queried.

Unit: milliseconds.

Note
  • You can query only the alert logs within the last year.

  • The interval between the start time (StartTime) and end time (EndTime) must be less than or equal to 15 days.

1609988009694
EndTimelongNo

The end timestamp of the alert logs to be queried.

Unit: milliseconds.

Note
  • You can query only the alert logs within the last year.

  • The interval between the start time (StartTime) and end time (EndTime) must be less than or equal to 15 days.

1609989009694
PageNumberintegerNo

The page number.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page.

Default value: 10.

10
SearchKeystringNo

The keyword that is used to query alert logs.

alert
GroupIdstringNo

The ID of the application group.

7301****
ProductstringNo

The abbreviation of the Alibaba Cloud service name.

ECS
NamespacestringNo

The namespace of the Alibaba Cloud service.

Note For more information about the namespaces of different cloud services, see Appendix 1: Metrics.
acs_ecs_dashboard
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 alert status. Valid values:

  • 0: The alert is triggered or cleared.
  • 1: The alert is ineffective.
  • 2: The alert is muted and not triggered in a specified period.
  • 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.
cpu_total
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
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.
RESOLVED
RuleIdstringNo

The ID of the alert rule.

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

ae06917_75a8c43178ab66****

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

Response parameters

ParameterTypeDescriptionExample
object

None.

Codestring

The response 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
AlertLogHistogramListarray<object>

The number of alert logs that were generated during each interval of a time period.

object
Fromlong

The start timestamp of the queried alert logs.

Unit: seconds.

1610074791
Tolong

The end timestamp of the queried alert logs.

Unit: seconds.

1610074800
Countinteger

The number of alert logs.

20

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "The specified resource is not found.",
  "RequestId": "1C4A3709-BF52-42EE-87B5-7435F0929585",
  "Success": true,
  "AlertLogHistogramList": [
    {
      "From": 1610074791,
      "To": 1610074800,
      "Count": 20
    }
  ]
}

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