Querying the Monitoring Data of a Metric of a Specified Granularity in a Specified Time Range
Function
Queries the monitoring data of a metric of a specified granularity in a specified time range.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
GET /v1/{project_id}/app-servers/server-metric-data/{server_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Unique ID of a project |
| server_id | Yes | String | Unique ID of a server. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| namespace | Yes | String | Service namespace, for example, SYS.ECS/AGT.ECS. If the namespace is AGT.ECS, GPU monitoring metrics will be queried. - SYS.ECS: basic monitoring metrics of ECS - AGT.ECS: OS monitoring metrics (GPU metrics) of ECS |
| metric_name | Yes | String | Monitoring metric names: - Metric names of the SYS.ECS namespace. For details, see Basic ECS Metrics. - Metric names of the AGT.ECS namespace. For details, see OS Metric: GPU. |
| from | Yes | String | Start time of the query. The time is a UNIX timestamp and the unit is ms. |
| to | Yes | String | End time of the query. The time is a UNIX timestamp and the unit is ms. The value of from must be earlier than that of to. |
| period | Yes | Integer | Monitoring data granularity. Options: - 1: real-time data - 300: 5-minute granularity - 1200: 20-minute granularity - 3600: 1-hour granularity - 14400: 4-hour granularity - 86400: 1-day granularity |
| filter | Yes | String | Data aggregation mode. The following aggregation modes are supported: - average: average value of metric data in an aggregation period; - max: maximum value of metric data in an aggregation period; - min: minimum value of metric data in an aggregation period; - sum: sum of metric data in an aggregation period; - variance: variance of metric data in an aggregation period |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | No | String | User token It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| server_metrics | Array of ServerMetricData objects | Monitoring data. |
| Parameter | Type | Description |
|---|---|---|
| metric_name | String | Metric name. |
| datapoints | Array of ServerDataPoints objects | Metric data list. |
| dimension_value | String | Dimension value. This parameter is specified only when GPU monitoring information is queried. |
| Parameter | Type | Description |
|---|---|---|
| average | Double | Average value of metric data within a rollup period. |
| max | Double | Maximum value of metric data within a rollup period. |
| min | Double | Minimum value of metric data within a rollup period. |
| sum | Double | Sum of metric data within a rollup period. |
| variance | Double | Variance of metric data within a rollup period. |
| timestamp | Long | Time when the metric is collected. It is a UNIX timestamp in millisecond. |
| unit | String | Metric unit. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 405
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Example Requests
GET /v1/a4da8115c9d8464ead3a38309130523f/app-servers/server-metric-data/8115c9d8464ead3a38309130?namespace=AGT.ECS&metric_name=cpu_util&from=1691671739879&to=1691671739872&period=1&filter=average
Example Responses
Status code: 200
Successful.
{
"server_metrics" : [ {
"datapoints" : [ {
"average" : 0.23,
"timestamp" : 1442341200000,
"unit" : "%"
} ],
"metric_name" : "gpu_usage_encoder",
"dimension_value" : "2e84018fc8b4484b94e89aae212fe615"
}, {
"datapoints" : [ {
"average" : 0.23,
"timestamp" : 1442341200000,
"unit" : "%"
} ],
"metric_name" : "gpu_usage_encoder",
"dimension_value" : "7784018fc8b4484b94e89aae212fe455"
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Successful. |
| 400 | The request cannot be understood by the server due to malformed syntax. |
| 401 | Authentication failed. |
| 403 | Permissions required. |
| 404 | No resources found. |
| 405 | The request method is not allowed. |
| 500 | An internal service error occurred. For details, see the error code description. |
| 503 | Service unavailable. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot