edit-icon download-icon

Query latest monitoring data

Last Updated: Mar 07, 2018

Description

Query the latest monitoring data of a specified monitored object.

Request type

GET

Request parameters

Name Type Required Description
Action String Yes The API name specified by the system. Value: QueryMetricLast
Project String Yes Name space. It indicates the product to which the monitoring data belongs, for example, “acs_ecs_dashboard” and “acs_rds_dashboard”.
Metric String Yes Monitoring metric name
Period String No Time interval is always calculated in seconds, for example, 60, 300, or 900. If this field is not specified, raw data is queried based on the report period stated during monitoring metric registration. If this field is specified, corresponding statistics are queried based on the specified period
StartTime String No The start time. It can be a millisecond value counted from 12:00:00 AM, January 1, 1970, or formatted data, for example, 2015-10-20 00:00:00
EndTime String No It can be a millisecond value counted from 00:00:00, January 1, 1970, or formatted data, for example, 2015-10-20 00:00:00
Dimensions String No Key-value set used to filter monitoring data. The key can use one or more dimensionKeys stated during monitoring metric registration and the value is the value corresponding to this key. instanceId is must. The Map object must be a JSON string and only strings can be input. Dimensions must be input in order
Length String No Returns the size of each page of monitoring data for paged queries. The default value is 1000, that is, 1,000 monitoring data entries per page.
Cursor String No Cursor

For how to assign values to input parameters of various cloud products, such as Project, Metric, Period, and Dimensions, see Preset monitoring metric.

Response parameters

Name Type Description
Period String Time interval is always calculated in seconds, for example, 60, 300, or 900
Cursor String Cursor
Datapoints List Monitoring data list, in the following format: { “timestamp”: 1490164200000,”Maximum”: 100,”userId”: “1234567898765432”, “Minimum”: 4.55,”instanceId”: “i-bp18abl200xk9599ck7c”, “Average”: 93.84}
Code String Status code. Code 200 is returned if no exception occurs
Success Boolean Whether the current query is successful. In case of any exception on the server side, the returned value is “false” (and “true” otherwise)
Message String Status description. The message is null when Code is 200
RequestId String When any issue arises with the request, you can provide this field to our technical support for troubleshooting

Error codes

Error code Description Meaning
400 Bad Request Syntax error in the client request
403 Forbidden No permission
404 Not Found Client error: not found
500 Internal Server Error Internal server error
200 OK Normal

Example

  • Request example
  1. http://metrics.cn-hangzhou.aliyuncs.com/?Action=QueryMetricLast
  2. &EndTime=2017-03-22+14%3A30%3A27
  3. &StartTime=2017-03-22+14%3A20%3A27
  4. &Period=60
  5. &Dimensions=%7BinstanceId%3A%27 i-abcdefgh123456%27%7D
  6. &Project=acs_ecs_dashboard
  7. &Metric=cpu_idle
  8. &<Common Request Parameters>
  • Response example

XML format

  1. <QueryMetricLastResponse>
  2. <Period>60</Period>
  3. <Datapoints>
  4. <Datapoints>
  5. <timestamp>1490164200000</timestamp>
  6. <Maximum>100</Maximum>
  7. <userId>1234567898765432</userId>
  8. <Minimum>4.55</Minimum>
  9. <instanceId>i-bp18abl200xk9599ck7c</instanceId>
  10. <Average>93.84</Average>
  11. </Datapoints>
  12. </Datapoints>
  13. <RequestId>021472A6-25E3-4094-8D00-BA4B6A5486C3</RequestId>
  14. <Success>true</Success>
  15. <Code>200</Code>
  16. </QueryMetricLastResponse>

JSON format

  1. {
  2. "Period": "60",
  3. "Datapoints": [
  4. {
  5. "timestamp": 1490164200000,
  6. "Maximum": 100,
  7. "userId": "1234567898765432",
  8. "Minimum": 4.55,
  9. "instanceId": "i-bp18abl200xk9599ck7c",
  10. "Average": 93.84
  11. }
  12. ],
  13. "RequestId": "4E7664F2-9CDE-4212-9318-A0712D345A5E",
  14. "Success": true,
  15. "Code": "200"
  16. }
Thank you! We've received your feedback.