# Fetch Monitoring Data - GetMetric

## Overview

Fetch Monitoring Data






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `GetMetric`.                      | **Yes** |
| **PublicKey**  | string  | AccessKey ID, obtained from [Console](https://console.dezai.com/uaccount/api_manage)                                              | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **Zone** | string | Availability Zone. See [Availability Zone List](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID, if not filled in, the default project will be used. Sub-accounts must fill in the Project ID. |No|
| **ResourceType** | string | Resource Type |**Yes**|
| **MetricName.N** | string | Metric Name (Different ResourceType corresponds to different MetricName) |**Yes**|
| **ResourceId** | string | Resource Id (Currently, except for sharebandwidth which can be omitted, other resources must be entered. If sharebandwidth is not entered, the first obtained Resource Id will be used by default) |No|
| **TimeRange** | int | Retrieve the monitoring data of the most recent seconds, default is 1 hour, i.e., 3600; the maximum is 1 month. |No|
| **BeginTime** | int | Start time unixtimestamp, this item is ignored if TimeRange is passed in. |No|
| **EndTime** | int | End time unixtimestamp, if TimeRange is input, this item will be ignored; if only BeginTime is input, this item defaults to the current time. |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **DataSets** | [*DataSet*](#dataset) | Data |No|

#### Data Model


#### DataSet

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Timestamp** | int | Timestamp |**Yes**|
| **Value** | int | Value |**Yes**|
| **IP** | string | Data Source IP Address |No|

## Example

### Request Example
    
```
https://apiucloud.dezai.com/?Action=GetMetric
&Region=CUPCMnhu
&Zone=xmiktFHL
&ProjectId=AeeicJWM
&ResourceType=iAqCBPNi
&MetricName.n=afvAGmoZ
&ResourceId=eNRBsUET
&TimeRange=NaN
&BeginTime=1
&EndTime=1
```

### Response Example
    
```json
{
  "Action": "GetMetricResponse",
  "DataSet": {},
  "Message": "tslFtPXU",
  "RetCode": 0
}
```





