Queries the number of alert logs that are generated during each interval within the last year.

This topic provides an example to show 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAlertLogHistogram

The operation that you want to perform. Set the value to DescribeAlertLogHistogram.

StartTime Long No 1609988009694

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.
EndTime Long No 1609989009694

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.
PageNumber Integer No 1

The number of the page to return.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each page.

Default value: 10.

SearchKey String No alert

The search keyword that is used to query alert logs.

GroupId String No 7301****

The ID of the application group.

Product String No ECS

The abbreviation of the cloud service name.

Namespace String No acs_ecs_dashboard

The namespace of the cloud service.

Note For more information about the namespaces of different cloud services, see Appendix 1: Metrics.
Level String No P4

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.
SendStatus String No 0

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.

ContactGroup String No ECS_Group

The alert contact group.

RuleName String No test123

The name of the alert rule.

MetricName String No cpu_total

The name of the metric.

Note For more information about the metrics of different cloud services, see Appendix 1: Metrics.
LastMin String No 360

The statistical period of alert logs. Unit: minutes.

GroupBy String No product

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.

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

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code.

Note The status code 200 indicates that the request was successful.
Message String The specified resource is not found.

The error message.

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

The request ID.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true
  • false
AlertLogHistogramList Array of AlertLogHistogramList

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

From Long 1610074791

The start timestamp of the queried alert logs.

Unit: seconds.

To Long 1610074800

The end timestamp of the queried alert logs.

Unit: seconds.

Count Integer 20

The number of alert logs.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeAlertLogHistogram
&Product=ECS
&GroupBy=product
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAlertLogHistogramResponse>
    <Code>200</Code>
    <Message>The specified resource is not found.</Message>
    <RequestId>1C4A3709-BF52-42EE-87B5-7435F0929585</RequestId>
    <Success>true</Success>
    <AlertLogHistogramList>
        <From>1610074791</From>
        <To>1610074800</To>
        <Count>20</Count>
    </AlertLogHistogramList>
</DescribeAlertLogHistogramResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The specified resource is not found.

For a list of error codes, see Service error codes.