pydo.monitoring.create_alert_policy()

Generated on 10 Jul 2025 from pydo version v0.13.0

Description

To create a new alert, send a POST request to /v2/monitoring/alerts.

Request Sample

import os
from pydo import Client

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

req = {
  "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": [
    "droplet_tag"
  ],
  "type": "v1/insights/droplet/cpu",
  "value": 80,
  "window": "5m"
}

resp = client.monitoring.create_alert_policy(body=req)

More Information

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

We can't find any results for your search.

Try using different keywords or simplifying your search terms.