Mengkueri data pemantauan terbaru dari sebuah metrik untuk layanan cloud. Data dapat diurutkan berdasarkan urutan yang ditentukan.
Deskripsi operasi
Limits
-
The total free quota is 1 million calls per month for the DescribeMetricLast, DescribeMetricList, DescribeMetricData, and DescribeMetricTop operations. If the free quota is used up and CloudMonitor Basic (pay-as-you-go) is not activated, these API operations can no longer be called as expected. If you have activated CloudMonitor Basic (pay-as-you-go), these API operations can still be called even if the free quota is used up. After the free quota is used up, you are charged for the excess usage based on the pay-as-you-go billing method. For more information about how to activate CloudMonitor Basic (pay-as-you-go), see Enable the pay-as-you-go billing method.
-
Each API operation can be called up to 10 times per second. An Alibaba Cloud account and the Resource Access Management (RAM) users within the account share the quota.
Precautions
The storage duration of the monitoring data of each cloud service is related to the Period parameter (statistical period). A larger value of the Period parameter indicates that the monitoring data is distributed in a larger time range and the storage duration of the monitoring data is longer. The following list describes the specific relationships:
-
The storage duration is 7 days if the value of the
Periodparameter is less than 60 seconds. -
The storage duration is 31 days if the value of the
Periodparameter is 60 seconds. -
The storage duration is 91 days if the value of the
Periodis greater than or equal to 300 seconds.
Operation description
This topic provides an example on how to query the monitoring data of the cpu_idle metric in the last 60 seconds for Elastic Compute Service (ECS). The namespace of ECS is acs_ecs_dashboard. The monitoring data is sorted in descending order based on the Average field.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:QueryMetricTop |
get |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Period |
string |
No |
Periode statistik data pemantauan. Nilai valid: 15, 60, 900, dan 3600. Unit: detik. Catatan
|
60 |
| Namespace |
string |
Yes |
Namespace layanan cloud. Untuk informasi lebih lanjut tentang namespace layanan cloud, lihat Lampiran 1: Metrik. |
acs_ecs_dashboard |
| MetricName |
string |
Yes |
Metrik yang digunakan untuk memantau layanan cloud. Untuk informasi lebih lanjut tentang nama metrik, lihat Lampiran 1: Metrik. |
cpu_idle |
| StartTime |
string |
No |
Awal pengatur waktu untuk mengkueri data pemantauan.
Format berikut didukung:
Catatan
|
2021-05-08 08:00:00 |
| EndTime |
string |
No |
Akhir pengatur waktu untuk mengkueri data pemantauan.
Format berikut didukung:
Catatan
Gunakan stempel waktu UNIX untuk mencegah masalah terkait zona waktu. |
2021-05-08 10:00:00 |
| Dimensions |
string |
No |
Dimensi pemantauan resource yang ditentukan. Tetapkan nilai ke kumpulan pasangan Catatan
Anda dapat mengkueri maksimum 50 instans di setiap permintaan. |
[{"instanceId": "i-2ze2d6j5uhg20x47****"}] |
| Orderby |
string |
Yes |
Bidang yang digunakan untuk mengurutkan data. Nilai valid:
|
Average |
| OrderDesc |
string |
No |
Urutan pengurutan data. Nilai valid:
|
false |
| Length |
string |
No |
Jumlah entri per halaman. Nilai default: 10. Catatan
Nilai maksimum parameter Length di permintaan adalah 1440. |
10 |
| Express |
string |
No |
Ekspresi yang digunakan untuk menghitung hasil kueri secara waktu nyata. Catatan
Hanya ekspresi |
{"groupby":["userId","instanceId"]} |
Untuk informasi lebih lanjut tentang parameter permintaan umum, lihat Parameter umum.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The HTTP status code. Catatan
The status code 200 indicates that the request was successful. |
200 |
| Message |
string |
The error message. |
The specified resource is not found. |
| RequestId |
string |
The request ID. |
3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42 |
| Datapoints |
string |
The monitoring data. |
[{\"order\":1,\"timestamp\":1620287520000,\"userId\":\"120886317861****\",\"instanceId\":\"i-j6ccf7d5fn335qpo****\",\"Average\":99.92,\"Minimum\":99.5,\"Maximum\":100.0,\"_count\":1.0},{\"order\":2,\"timestamp\":1620287520000,\"userId\":\"120886317861****\",\"instanceId\":\"i-0xii2bvf42iqvxbp****\",\"Average\":99.91,\"Minimum\":99.0,\"Maximum\":100.0,\"_count\":1.0}] |
| Period |
string |
The statistical period of the monitoring data. Unit: seconds. Valid values: 15, 60, 900, and 3600. |
60 |
Contoh
Respons sukses
JSONformat
{
"Code": "200",
"Message": "The specified resource is not found.",
"RequestId": "3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42",
"Datapoints": "[{\\\"order\\\":1,\\\"timestamp\\\":1620287520000,\\\"userId\\\":\\\"120886317861****\\\",\\\"instanceId\\\":\\\"i-j6ccf7d5fn335qpo****\\\",\\\"Average\\\":99.92,\\\"Minimum\\\":99.5,\\\"Maximum\\\":100.0,\\\"_count\\\":1.0},{\\\"order\\\":2,\\\"timestamp\\\":1620287520000,\\\"userId\\\":\\\"120886317861****\\\",\\\"instanceId\\\":\\\"i-0xii2bvf42iqvxbp****\\\",\\\"Average\\\":99.91,\\\"Minimum\\\":99.0,\\\"Maximum\\\":100.0,\\\"_count\\\":1.0}]",
"Period": "60"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ParameterInvalid | Illegal parameters. | |
| 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. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.