doctl monitoring alert create
Generated on 9 Apr 2025
from doctl
version
v1.124.0
Usage
doctl monitoring alert create [flags]
Description
Creates a new alert policy. You can create policies that monitor various metrics of your Droplets and send you alerts when a metric exceeds a specified threshold.
For example, you can create a policy that monitors a Droplet's CPU usage and triggers an alert when the Droplet's CPU usage exceeds more than 80% for more than 10 minutes.
For a full list of policy types you can set up, see our API documentation: https://docs.digitalocean.com/reference/api/api-reference/#operation/monitoring_create_alertPolicy
Example
The following example creates an alert policy that sends an email to [email protected]
whenever the memory usage on the listed Droplets (entities) exceeds 80% for more than five minutes:
doctl monitoring alert create --type "v1/insights/droplet/memory_utilization_percent" --compare GreaterThan --value 80 --window 5m --entities 386734086,191669331 --emails [email protected]
Flags
Option | Description |
---|---|
--compare |
The comparator of the alert policy. Possible values: GreaterThan or LessThan |
--description |
A description of the alert policy |
--emails |
Email address to send alerts to |
--enabled |
Enables the alert policy Default: true |
--entities |
Resources to apply the alert against, such as a Droplet ID. |
--help , -h |
Help for this command |
--slack-channels |
A Slack channel to send alerts to. For example, production-alerts |
--slack-urls |
A Slack webhook URL to send alerts to, for example, https://hooks.slack.com/services/T1234567/AAAAAAAA/ZZZZZZ . |
--tags |
Tags to apply the alert policy to. If set to a tag, all Droplet with that tag are monitored by the alert policy. |
--type |
The type of alert policy. For example,v1/insights/droplet/memory_utilization_percent alerts on the percent of memory utilization. For a full list of alert types, see https://docs.digitalocean.com/reference/api/api-reference/#operation/monitoring_create_alertPolicy |
--value |
The threshold value of the alert policy to compare against. For example, if the alert policy is of type DropletCPUUtilizationPercent and the value is set to 80 , an alert is triggered if the Droplet’s CPU usage exceeds 80% for the specified window.Default: 0 |
--window |
The amount of time the resource must exceed the threshold value before an alert is triggered. Possible values: 5m , 10m , 30m , or 1h Default: 5m |
Related Commands
Command | Description |
---|---|
doctl monitoring alert | Display commands for managing alert policies |
Global Flags
Option | Description |
---|---|
--access-token , -t |
API V2 access token |
--api-url , -u |
Override default API endpoint |
--config , -c |
Specify a custom config file Default: |
--context |
Specify a custom authentication context name |
--http-retry-max |
Set maximum number of retries for requests that fail with a 429 or 500-level error
Default: 5 |
--http-retry-wait-max |
Set the minimum number of seconds to wait before retrying a failed request
Default: 30 |
--http-retry-wait-min |
Set the maximum number of seconds to wait before retrying a failed request
Default: 1 |
--interactive |
Enable interactive behavior. Defaults to true if the terminal supports it (default false)
Default: false |
--output , -o |
Desired output format [text|json] Default: text |
--trace |
Show a log of network activity while performing a command Default: false |
--verbose , -v |
Enable verbose output Default: false |