pydo.monitoring.list_alert_policy()

Description

Returns all alert policies that are configured for the given account. To List all alert policies, send a GET request to /v2/monitoring/alerts.

Parameters

Name Type Required Description Default Value
per_page integer False Number of items returned per page 20
page integer False Which ‘page’ of paginated results to return. 1

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.monitoring.list_alert_policy()

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A list of alert policies.

Click to expand an example response.
{
  "policies": [
    {
      "alerts": {
        "email": [
          "[email protected]"
        ],
        "slack": [
          {
            "channel": "Production Alerts",
            "url": "https://hooks.slack.com/services/T1234567/AAAAAAAA/ZZZZZZ\""
          }
        ]
      },
      "compare": "GreaterThan",
      "description": "CPU Alert",
      "enabled": true,
      "entities": [
        192018292
      ],
      "tags": [
        "production_droplets"
      ],
      "type": "v1/insights/droplet/cpu",
      "uuid": "78b3da62-27e5-49ba-ac70-5db0b5935c64",
      "value": 80,
      "window": "5m"
    }
  ],
  "links": {
    "first": "https//api.digitalocean.com/v2/monitoring/alerts?page=1&per_page=10",
    "prev": "https//api.digitalocean.com/v2/monitoring/alerts?page=2&per_page=10",
    "next": "https//api.digitalocean.com/v2/monitoring/alerts?page=4&per_page=10",
    "last": "https//api.digitalocean.com/v2/monitoring/alerts?page=5&per_page=10"
  },
  "meta": {
    "total": 50
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}