Queries the statistics of alert logs within the last year.
This topic provides an example to show how to query the statistics of alert logs for Elastic Compute Service (ECS) based on the product
dimension.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeAlertLogCount | The operation that you want to perform. Set the value to DescribeAlertLogCount. |
StartTime | Long | No | 1609988009694 | The start timestamp of the alert logs to be queried. Unit: milliseconds. Note
|
EndTime | Long | No | 1610074409694 | The end timestamp of the alert logs to be queried. Unit: milliseconds. Note
|
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 | test | The keyword based on which the statistics of alert logs are searched. |
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. |
GroupId | String | No | 7301**** | The ID of the application group. |
Product | String | No | ECS | The abbreviation of the cloud service name. |
Level | String | No | P4 | The severity level and notification methods of the alert. Valid values:
|
SendStatus | String | No | 0 | The alert status. Valid values:
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 | Yes | product | The dimension based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL. Valid values:
|
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 returned message. |
RequestId | String | 1C4A3709-BF52-42EE-87B5-7435F0929585 | The request ID. |
Success | Boolean | true | Indicates whether the request was successful. Valid values:
|
AlertLogCount | Array of AlertLogCount | The statistics of alert logs. |
|
Count | Integer | 1 | The number of alert logs. |
Logs | Array of Logs | The details about alert logs. |
|
Name | String | product | The name of the dimension field based on which alert logs are aggregated. |
Value | String | ECS | The value of the dimension field based on which alert logs are aggregated. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DescribeAlertLogCount
&GroupBy=product
&Product=ECS
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeAlertLogCountResponse>
<RequestId>0BA67F6D-B699-4E3F-B205-93A5C38A0A2E</RequestId>
<AlertLogCount>
<Count>1</Count>
<Logs>
<Value>ECS</Value>
<Name>product</Name>
</Logs>
</AlertLogCount>
<Code>200</Code>
<Success>true</Success>
</DescribeAlertLogCountResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0BA67F6D-B699-4E3F-B205-93A5C38A0A2E",
"AlertLogCount" : [ {
"Count" : 1,
"Logs" : [ {
"Value" : "ECS",
"Name" : "product"
} ]
} ],
"Code" : 200,
"Success" : true
}
Error codes
HTTP status code | 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.