DescribeAlertLogHistogram

Updated at:

Queries the histogram list of alert history.

Operation description

This topic provides an example of querying the histogram list of Elastic Compute Service (ECS) alert history by the product dimension of cloud services.

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:DescribeAlertLogHistogram

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

StartTime

integer

No

The start timestamp for querying alert history.

Unit: milliseconds.

Note
  • You can only query the alert history of the last year.

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

1609988009694

EndTime

integer

No

The end timestamp for querying alert history.

Unit: milliseconds.

Note
  • You can only query the alert history of the last year.

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

1609989009694

PageNumber

integer

No

The page number.

Default value: 1.

1

PageSize

integer

No

The number of entries to return on each page.

Default value: 10.

10

SearchKey

string

No

The search keyword for querying alert history.

alert

GroupId

string

No

The ID of the application group.

7301****

Product

string

No

The abbreviation of the cloud service name.

ECS

Namespace

string

No

The namespace of the cloud service.

Note

For more information about the namespaces of cloud services, see Cloud service metrics.

acs_ecs_dashboard

Level

string

No

The alert level and notification method. Valid values:

  • P2: Phone call + text message + email + DingTalk chatbot.

  • P3: Text message + email + DingTalk chatbot.

  • P4: Email + DingTalk chatbot.

  • OK: No alert.

P4

SendStatus

string

No

The alert status. Valid values:

  • 0: An alert is triggered or the alert recovers to Normal.

  • 1: Outside the effective period.

  • 2: Mute epoch.

  • 3: The host is restarting.

  • 4: Does not send alert notifications.

If the alert status is 0 and the value of Level is P2, P3, or P4, an alert is triggered. If the value of Level is OK, the alert recovers to Normal.

0

ContactGroup

string

No

The alert contact group.

ECS_Group

RuleName

string

No

The name of the alert rule.

test123

MetricName

string

No

The name of the metric.

Note

For more information about the metrics of cloud services, see Cloud service metrics.

cpu_total

LastMin

string

No

The period for retrieving logs. Unit: minutes.

360

GroupBy

string

No

The dimension for data aggregation, which 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 by cloud service and metric.

product

SourceType deprecated

string

No

[Deprecated] This parameter is deprecated. You do not need to specify this parameter.

None

EventType

string

No

The alert type. Valid values:

  • TRIGGERED: The alert is triggered.

  • RESOLVED: The alert recovers.

RESOLVED

RuleId

string

No

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 elements

Element

Type

Description

Example

object

None.

Code

string

The status code.

Note

200 indicates success.

200

Message

string

The error message.

The specified resource is not found.

RequestId

string

The request ID.

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

Success

boolean

Indicates whether the operation is successful. Valid values:

  • true: The operation is successful.

  • false: The operation fails.

true

AlertLogHistogramList

array<object>

The histogram list of the queried alert history.

object

None.

From

integer

The start timestamp of the queried alert history.

Unit: seconds.

1610074791

To

integer

The end timestamp of the queried alert history.

Unit: seconds.

1610074800

Count

integer

The number of alert history records.

20

Examples

Success response

JSON format

{
  "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 code

Error code

Error message

Description

400 ParameterInvalid %s
500 InternalError The request processing has failed due to some unknown error.
403 AccessForbidden User not authorized to operate on the specified resource.
404 ResourceNotFound The specified resource is not found. The specified resource is not found.
409 ResourceConflict Concurrent modification of resources.
409 ResourceExist Resources already exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.