# Bare Metal Cloud › VPS › Monitoring API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Bare Metal Cloud product's sections: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 2 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/monitoring/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/bare-metal-cloud/vps/monitoring.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/bare-metal-cloud/vps/monitoring.json?format=openapi3

## Operations

- `GET /vps/{serviceName}/disks/{id}/monitoring` — Retrieve disk monitoring statistics for this VPS over a given period
- `GET /vps/{serviceName}/disks/{id}/use` — Retrieve current disk usage metrics for this VPS

## Retrieve disk monitoring statistics for this VPS over a given period

`GET /1.0/vps/{serviceName}/disks/{id}/monitoring`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/monitoring/#getVpsDiskMonitoring

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:disks/monitoring/get`

Returns the monitoring values of the disk for the requested period, as timestamped points.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `period` | query | vps.VpsMonitoringPeriodEnum | yes | The period the statistics are fetched for — one of `lastday`, `lastmonth`, `lastweek`, `lastyear`, `today` |
| `serviceName` | path | string | yes | Service name |
| `type` | query | vps.disk.StatisticTypeEnum | yes | The type of statistic to be fetched — one of `max`, `used` |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | complexType.UnitAndValues_vps.VpsTimestampValue | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `unit` | string | read-only |  |
| `values` | vps.VpsTimestampValue[] | read-only |  |
| `values[].timestamp` | integer | read-only |  |
| `values[].value` | number | read-only |  |

```json
{
  "unit": "string",
  "values": [
    {
      "timestamp": 0,
      "value": 0
    }
  ]
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/disks/{id}/monitoring" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/vps/{serviceName}/disks/{id}/monitoring")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/vps/{serviceName}/disks/{id}/monitoring");

print_r($result);
?>
```

## Retrieve current disk usage metrics for this VPS

`GET /1.0/vps/{serviceName}/disks/{id}/use`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/monitoring/#getVpsDiskUsage

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:disks/use/get`

Returns the current disk usage as a value and its unit.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |
| `type` | query | vps.disk.StatisticTypeEnum | yes | The type of statistic to be fetched — one of `max`, `used` |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | complexType.UnitAndValue_double | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `unit` | string | read-only |  |
| `value` | number | read-only |  |

```json
{
  "unit": "string",
  "value": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/disks/{id}/use" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/vps/{serviceName}/disks/{id}/use")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/vps/{serviceName}/disks/{id}/use");

print_r($result);
?>
```
