---
title: monitoring_alert_policy
description: Create or delete monitoring alert policy
product: Reference
url: https://docs.digitalocean.com/reference/ansible/reference/modules/monitoring_alert_policy/
last_updated: "2026-11-09"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# monitoring_alert_policy

## Synopsis

Create or delete monitoring alert policy. View the API documentation at [https://docs.digitalocean.com/reference/api/api-reference/#tag/Monitoring](https://docs.digitalocean.com/reference/api/reference/monitoring/index.html.md).

## Requirements

- pydo >= 0.1.3
- azure-core >= 1.26.1

## Parameters

Parameter Choices / Default Description

`alerts`, dict / **required** Alert object.

`client_override_options`, dict Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options.

`compare`, str / **required** Choices:

- `GreaterThan`
- `LessThan`

Comparision.

`description`, str / **required** Description.

`enabled`, bool / **required** Enabled.

`entities`, list / elements=str / **required** Entities.

`module_override_options`, dict Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options.

`state`, str Choices:

- `present` (default)
- `absent`

State of the resource, `present` to create, `absent` to destroy.

`tags`, list / elements=str / **required** Tags.

`timeout`, int Default: `300` Polling timeout in seconds.

`token`, str DigitalOcean API token. There are several environment variables which can be used to provide this value. `DIGITALOCEAN_ACCESS_TOKEN`, `DIGITALOCEAN_TOKEN`, `DO_API_TOKEN`, `DO_API_KEY`, `DO_OAUTH_TOKEN` and `OAUTH_TOKEN`

`type`, str / **required** Choices:

- `v1/insights/droplet/load_1`
- `v1/insights/droplet/load_5`
- `v1/insights/droplet/load_15`
- `v1/insights/droplet/memory_utilization_percent`
- `v1/insights/droplet/disk_utilization_percent`
- `v1/insights/droplet/cpu`
- `v1/insights/droplet/disk_read`
- `v1/insights/droplet/disk_write`
- `v1/insights/droplet/public_outbound_bandwidth`
- `v1/insights/droplet/public_inbound_bandwidth`
- `v1/insights/droplet/private_outbound_bandwidth`
- `v1/insights/droplet/private_inbound_bandwidth`
- `v1/insights/lbaas/avg_cpu_utilization_percent`
- `v1/insights/lbaas/connection_utilization_percent`
- `v1/insights/lbaas/droplet_health`
- `v1/insights/lbaas/tls_connections_per_second_utilization_percent`
- `v1/insights/lbaas/increase_in_http_error_rate_percentage_5xx`
- `v1/insights/lbaas/increase_in_http_error_rate_percentage_4xx`
- `v1/insights/lbaas/increase_in_http_error_rate_count_5xx`
- `v1/insights/lbaas/increase_in_http_error_rate_count_4xx`
- `v1/insights/lbaas/high_http_request_response_time`
- `v1/insights/lbaas/high_http_request_response_time_50p`
- `v1/insights/lbaas/high_http_request_response_time_95p`
- `v1/insights/lbaas/high_http_request_response_time_99p`
- `v1/dbaas/alerts/load_15_alerts`
- `v1/dbaas/alerts/memory_utilization_alerts`
- `v1/dbaas/alerts/disk_utilization_alerts`
- `v1/dbaas/alerts/cpu_alerts`

Type.

`value`, float / **required** Value.

`window`, str / **required** Choices:

- `5m`
- `10m`
- `30m`
- `1h`

Window.

## Examples

```yaml
- name: Create monitoring alert policy
  digitalocean.cloud.monitoring_alert_policy:
    token: "{{ token }}"
    state: present
    alerts:
      email:
        - bob@example.com
      slack:
        - channel: Production Alerts
          url: https://hooks.slack.com/services/T1234567/AAAAAAAA/ZZZZZZ
    compare: GreaterThan
    description: CPU Alert
    enabled: true
    entities:
      - 192018292
    tags:
      - droplet_tag
    type: v1/insights/droplet/cpu
    value: 80
    window: 5m
```

## Return Values

KeyReturnedDescription

`alerts`, dict always Monitoring alert policy information., Sample:,

```json
{
  "alerts": {
    "email": [
      "bob@exmaple.com"
    ],
    "slack": [
      {
        "channel": "Production Alerts",
        "url": "https://hooks.slack.com/services/T1234567/AAAAAAAA/ZZZZZZ"
      }
    ]
  },
  "compare": "GreaterThan",
  "description": "CPU Alert",
  "enabled": true,
  "entities": [
    "192018292"
  ],
  "tags": [
    "droplet_tag"
  ],
  "type": "v1/insights/droplet/cpu",
  "value": 80,
  "window": "5m"
}
```

`error`, dict failure DigitalOcean API error., Sample:,

```json
{
  "Message": "Informational error message.",
  "Reason": "Unauthorized",
  "Status Code": 401
}
```

`msg`, str always Monitoring alert policy result information., Sample:,

```json
[
  "Created redis database cluster backend (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3",
  "Deleted redis database cluster backend (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3",
  "redis database cluster backend in nyc3 would be created",
  "redis database cluster backend (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3 exists",
  "redis database cluster backend in nyc3 does not exist",
  "redis database cluster backend (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) would be deleted"
]
```