# Client API: Cloud Compute alerts

> Monitoring alerts on an instance: CPU, disk, data transfer this month and down, each emailed when it fires and when it clears.

Source: https://www.coritan.com/docs/api/reference/client/cloud-compute-alerts/

Monitoring alerts on an instance: CPU, disk, data transfer this month and down, each emailed when it fires and when it clears. Paths are under `/api/v1/client/vps/{uuid}/alerts`.

Base URL: `https://api.coritan.com/api/v1`. Paths below are complete.

To try these requests in the browser, open the [interactive Client API reference](https://api.coritan.com/docs).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/client/vps/{uuid}/alerts`](#op-get-api-v1-client-vps-uuid-alerts) | List alerts |
| POST | [`/api/v1/client/vps/{uuid}/alerts`](#op-post-api-v1-client-vps-uuid-alerts) | Add an alert |
| PATCH | [`/api/v1/client/vps/{uuid}/alerts/{rule_uuid}`](#op-patch-api-v1-client-vps-uuid-alerts-rule-uuid) | Change an alert's threshold, duration or port, pause it, or stop its emails |
| DELETE | [`/api/v1/client/vps/{uuid}/alerts/{rule_uuid}`](#op-delete-api-v1-client-vps-uuid-alerts-rule-uuid) | Delete an alert |

### List alerts {#op-get-api-v1-client-vps-uuid-alerts}

`GET /api/v1/client/vps/{uuid}/alerts`

The instance's alert rules with where each stands, its last 50 alert events, and the metrics on offer.

404 while monitoring alerts are off.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Add an alert {#op-post-api-v1-client-vps-uuid-alerts}

`POST /api/v1/client/vps/{uuid}/alerts`

Add an alert. 422 names what is wrong with a field; 409 once the instance holds the most it may.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `metric` | string | yes | cpu, disk, bandwidth or down. |
| `threshold` | integer or null | no | cpu and disk: percent, 1 to 100. bandwidth: GB this month. Not used for down. |
| `duration_minutes` | integer or null | no | cpu and down: minutes the condition must hold, 1 to 1440 (default 5 and 3). |
| `port` | integer or null | no | down only: a TCP port that must answer on the instance's IPv4 address. |
| `notify_email` | boolean | no | Email the account when the alert fires and when it clears. |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Change an alert's threshold, duration or port, pause it, or stop its emails {#op-patch-api-v1-client-vps-uuid-alerts-rule-uuid}

`PATCH /api/v1/client/vps/{uuid}/alerts/{rule_uuid}`

Change an alert's threshold, duration or port, pause it, or stop its emails. A changed condition starts it over.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `rule_uuid` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `threshold` | integer or null | no |
| `duration_minutes` | integer or null | no |
| `port` | integer or null | no |
| `enabled` | boolean or null | no |
| `notify_email` | boolean or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Delete an alert {#op-delete-api-v1-client-vps-uuid-alerts-rule-uuid}

`DELETE /api/v1/client/vps/{uuid}/alerts/{rule_uuid}`

Delete an alert. Its past events stay in the history.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `rule_uuid` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
