
# 批量获取资源统计数据
#### 功能介绍
批量获取资源统计数据
#### URI
POST /v1/{project_id}/metric-data/batch-stat-metric-data
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                   |
|:---|:---|:---|:---|
| project_id | 是    | String | 华为云项目ID，您可以从[获取项目ID](https://support.huaweicloud.com/api-eihealth/eihealth_33_0044.html)中获取。 最小长度：**1** 最大长度：**128** |
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                         |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。Token认证就是在调用API的时候将Token加到请求消息头，从而通过身份认证，获得操作API的权限，[获取Token](https://support.huaweicloud.com/api-eihealth/eihealth_33_0010.html)接口响应消息头中X-Subject-Token的值即为Token。 |
   
表3请求Body参数 
| 参数           | 是否必选 | 参数类型             | 描述                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| from_time    | 否    | Long             | 查询监控数据起始时间，UNIX时间戳，单位毫秒，不填时默认为当前时间                                                                                                                                                                              |
| to_time      | 否    | Long             | 查询数据截止时间，UNIX时间戳，单位毫秒，不填时默认为当前时间                                                                                                                                                                                |
| period       | 否    | String           | 监控数据周期。枚举值，取值范围：real_time（实时数据）、five_minutes（5分钟粒度）、fifteen_to_twenty_minutes（15-20分钟粒度）、one_hour（1小时粒度），不填时默认为real_time 枚举值： - **real_time** - **five_minutes** - **fifteen_to_twenty_minutes** - **one_hour** |
| method       | 否    | String           | 统计方法。枚举值，取值范围：max（最大值）、min（最小值）、average（平均值），不填时默认为max 枚举值： - **max** - **min** - **average**                                                                                                                   |
| resource_ids | 是    | Array of strings | 查询的监控资源对象id集合 最小长度：**1** 最大长度：**128** 数组长度：**1 - 50**                                                                                                                                                           |
   
#### 响应参数
**状态码： 200**
表4响应Body参数 
| 参数                | 参数类型                                                                                                 | 描述       |
|:---|:---|:---|
| metric_statistics | Array of [ResourceStatDataRsp] objects | 资源统计数据列表 |
   
 表5ResourceStatDataRsp 
| 参数          | 参数类型   | 描述     |
|:---|:---|:---|
| statistic   | String | 统计值    |
| unit        | String | 数据单位   |
| metric_name | String | 监控指标名称 |
| resource_id | String | 监控资源id |
| device_id   | String | 显卡id   |
   
#### 请求示例
批量下载监控数据，设置起止时间，实时数据，统计方式为max, 指定资源id列表
```
https://eihealth.cn-north-4.myhuaweicloud.com/v1/{project_id}/metric-data/batch-stat-metric-data
{
  "from_time" : 1234567891011,
  "to_time" : 1234567891012,
  "period" : "real_time",
  "method" : "max",
  "resource_ids" : [ 123456789 ]
}
```
#### 响应示例
**状态码： 200**
OK
```
{
  "metric_statistics" : [ {
    "statistic" : "12345",
    "unit" : "bytes/second",
    "metric_name" : "read_bandwidth",
    "resource_id" : "123456789",
    "device_id" : "123456789"
  } ]
}
```
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-eihealth/ErrorCode.html)。
