pydo.insights.update_alert_rule()
Generated on 6 Nov 2026
from pydo version
v0.45.0
Usage
client.insights.update_alert_rule(
id="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
body={
"spec": {...},
"status": "ALERT_RULE_STATUS_ACTIVE",
},
)Description
This PUT endpoint uses merge semantics. To update an alert rule, send a
request to /v2/insights/alert-rules/{id} with a full spec. Omit
notification_channels to keep existing bindings. Omit status or
re_alert_duration to keep those existing values.
Parameters
idstring requiredA unique identifier for an alert rule.
specobject requiredSpec for an Insights alert rule. On create,
name,query,thresholds,
and at least onenotification_channelsbinding are required. On update,
omitnotification_channelsto keep existing bindings; an explicit empty
list is rejected.Show child properties
namestring requiredExample:
High CPUA human-readable name for the alert rule.
queryobject requiredMetrics query that the alert rule evaluates.
metricmust be a dotted
OpenTelemetry name (for exampledo.droplets.cpu_utilization). Underscored
Prometheus-style names are rejected. Whenresource_urnsis omitted or empty,
the rule is not scoped to specific resources.Show child properties
metricstring requiredExample:
do.droplets.cpu_utilizationDotted OpenTelemetry metric name to evaluate
(for exampledo.droplets.cpu_utilization).filtersarray of objects optionalOptional label filters applied to the metric series.
Show child properties
fieldstring requiredExample:
host_idThe metric label or field to filter on.
operatorstring requiredComparison operator for the filter. Allowed values:
-FILTER_OPERATOR_EQUAL= equal
-FILTER_OPERATOR_NOT_EQUAL=not_equal
-FILTER_OPERATOR_LESS_THAN=less_than
-FILTER_OPERATOR_LESS_THAN_OR_EQUAL=less_than_or_equal
-FILTER_OPERATOR_GREATER_THAN=greater_than
-FILTER_OPERATOR_GREATER_THAN_OR_EQUAL=greater_than_or_equalvaluestring requiredExample:
12345678Value compared against the field.
resource_urnsarray of strings optionalExample:
['do:droplet:12345']Optional list of DigitalOcean resource URNs the rule applies to. Empty or
omitted means the rule is not scoped to specific resources.tagsarray of strings optionalExample:
['env:prod']Optional resource tags used to select matching resources.
conditionobject optionalEvaluation condition for the alert rule.
Show child properties
windowstring optionalTime window over which the metric is evaluated. Allowed values:
-EVALUATION_WINDOW_1M=1m
-EVALUATION_WINDOW_5M=5m
-EVALUATION_WINDOW_10M=10m
-EVALUATION_WINDOW_15M=15m
-EVALUATION_WINDOW_30M=30m
-EVALUATION_WINDOW_1H=1h
thresholdsobject requiredThreshold configuration for the alert rule. At least one of
warningorcriticalmust be set.Show child properties
warningnumber optionalExample:
80Warning threshold value.
criticalnumber optionalExample:
95Critical threshold value.
operatorstring requiredComparison operator applied to the aggregated metric value. Allowed
values:
-THRESHOLD_OPERATOR_EQUAL= equal
-THRESHOLD_OPERATOR_LESS_THAN_OR_EQUAL=less_than_or_equal
-THRESHOLD_OPERATOR_LESS_THAN=less_than
-THRESHOLD_OPERATOR_GREATER_THAN=greater_than
-THRESHOLD_OPERATOR_GREATER_THAN_OR_EQUAL=greater_than_or_equal
-THRESHOLD_OPERATOR_NOT_EQUAL=not_equal
notification_channelsarray of objects optionalNotification channels to notify when the rule fires.
Show child properties
notification_channel_idstring requiredExample:
550e8400-e29b-41d4-a716-446655440000ID of an existing notification channel owned by the account.
notify_onarray of strings optionalExample:
['SEVERITY_CRITICAL']Severities that trigger this channel. Allowed values:
-SEVERITY_WARNING= warning
-SEVERITY_CRITICAL= critical
re_alert_durationstring optionalMinimum wait before re-notifying a still-firing alert. Defaults to
RE_ALERT_DURATION_4Hon create when omitted. Allowed values:
-RE_ALERT_DURATION_30M=30m
-RE_ALERT_DURATION_1H=1h
-RE_ALERT_DURATION_4H=4h
-RE_ALERT_DURATION_NEVER= never
statusstring optionalDesired alert rule status. Allowed values:
-ALERT_RULE_STATUS_ACTIVE= active
-ALERT_RULE_STATUS_PAUSED= paused
Request Sample
Response Example
More Information
See /v2/insights/alert-rules/{id} in the API reference for additional detail on responses, headers, parameters, and more.