Mengkueri data pemantauan metrik tertentu untuk layanan cloud.
Deskripsi operasi
Limits
-
You have a free quota of 1 million total API calls per month for the DescribeMetricLast, DescribeMetricList, DescribeMetricData, and DescribeMetricTop operations. If you use up the free quota and have not enabled the pay-as-you-go billing method for CloudMonitor Basic, you can no longer use these API operations. If you have enabled the pay-as-you-go billing method, you can continue to use the API operations after the free quota is used up. API calls that exceed the free quota are automatically charged on a pay-as-you-go basis. For more information, see Enable pay-as-you-go.
-
You can call each API operation up to 50 times per second. This limit is shared between an Alibaba Cloud account and its RAM users.
If you receive the Throttling.User or Request was denied due to user flow control error message when you call an API operation, the API call is throttled. For more information, see How do I resolve an API call throttling issue?.
Notes
The storage duration of monitoring data for a cloud service depends on the Period (statistical period). A larger Period value indicates that the monitoring data is less granular and is stored for a longer period. The relationship is as follows:
-
If the value of
Periodis less than 60 seconds, the storage duration is 7 days. -
If the value of
Periodis 60 seconds, the storage duration is 31 days. -
If the value of
Periodis 300 seconds or greater, the storage duration is 91 days.
Usage notes
This topic provides an example of how to query the monitoring data of the cpu_idle metric for the acs_ecs_dashboard cloud service. The response shows the data for the instance i-abcdefgh12****, which belongs to the Alibaba Cloud account 120886317861****. At a 60 second interval, the maximum, minimum, and average values of the metric are 100, 93.1, and 99.52, respectively.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:QueryMetricList |
get |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Namespace |
string |
Yes |
Namespace layanan cloud. Untuk informasi selengkapnya, lihat Metrik. |
acs_ecs_dashboard |
| MetricName |
string |
Yes |
Nama metrik. Untuk informasi selengkapnya, lihat Metrik. |
cpu_idle |
| Period |
string |
No |
Periode statistik data Pemantauan. Nilai valid: 15, 60, 900, dan 3600. Unit: detik. Catatan
|
60 |
| StartTime |
string |
No |
Awal pengatur waktu yang akan dikueri. Format berikut didukung:
Catatan
|
2019-01-30 00:00:00 |
| EndTime |
string |
No |
Akhir Rentang Waktu yang akan dikueri. Format berikut didukung:
Catatan
Interval antara `StartTime` dan `EndTime` harus kurang dari atau sama dengan 31 hari. |
2019-01-30 00:10:00 |
| Dimensions |
string |
No |
Dimensi yang menentukan Sumber daya yang akan dipantau. Format: kumpulan pasangan kunci-nilai, seperti Catatan
Satu permintaan dapat digunakan untuk mengkueri maksimum 50 Instans. |
[{"instanceId":"i-2ze2d6j5uhg20x47****"}] |
| NextToken |
string |
No |
Kursor paginasi. Catatan
Jika Anda tidak menetapkan parameter ini, halaman pertama data akan dikembalikan. Jika nilai dikembalikan untuk parameter ini, ini menunjukkan bahwa lebih banyak data tersedia. Untuk mengambil halaman berikutnya, gunakan nilai yang dikembalikan sebagai `NextToken` di permintaan Anda berikutnya. Nilai null menunjukkan bahwa semua data telah diambil. |
15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8**** |
| Length |
string |
No |
Jumlah entri yang akan dikembalikan pada setiap halaman untuk kueri berhalaman. Catatan
Nilai maksimum `Length` dalam satu permintaan adalah 1440. |
1000 |
| Express |
string |
No |
Ekspresi yang digunakan untuk komputasi waktu nyata berdasarkan hasil kueri. Catatan
Hanya ekspresi kelompok yang didukung. Ekspresi ini mirip dengan pernyataan GROUP BY dalam database. |
{"groupby":["userId","instanceId"]} |
Untuk informasi selengkapnya tentang parameter permintaan umum, lihat Parameter umum.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| NextToken |
string |
The pagination cursor. |
15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae**** |
| RequestId |
string |
The request ID. |
3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42 |
| Success |
boolean |
Indicates whether the operation was successful. Valid values:
|
true |
| Datapoints |
string |
The list of monitoring data. |
[{"timestamp":1548777660000,"userId":"120886317861****","instanceId":"i-abc","Minimum":9.92,"Average":9.92,"Maximum":9.92}] |
| Code |
string |
The status code. Catatan
A value of 200 indicates that the call was successful. |
200 |
| Message |
string |
The error message. |
The specified resource is not found. |
| Period |
string |
The statistical period. Unit: seconds. Valid values: 60, 300, and 900. |
60 |
Contoh
Respons sukses
JSONformat
{
"NextToken": "15761441850009dd70bb64cff1f0fff6d0b08ffff073be5fb1e785e2b020f7fed9b5e137bd810a6d6cff5ae****",
"RequestId": "3121AE7D-4AFF-4C25-8F1D-C8226EBB1F42",
"Success": true,
"Datapoints": "[{\"timestamp\":1548777660000,\"userId\":\"120886317861****\",\"instanceId\":\"i-abc\",\"Minimum\":9.92,\"Average\":9.92,\"Maximum\":9.92}]",
"Code": "200",
"Message": "The specified resource is not found.",
"Period": "60"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | %s | %s | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | %s | %s | |
| 404 | ResourceNotFound | The specified resource is not found. | The specified resource is not found. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.