Change an alarm
Change an alarm's rule or recipients, or stop and resume its notifications.
Replace alarm-id with the alarm's id. Send only the fields to change; the others keep their values.
Important
Changing what the alarm measures (resource type, resource, metric, dimensions, statistic,
comparison, threshold, period or evaluation periods) resets it to INSUFFICIENT_DATA, with the
reason "The alarm was changed and has not been evaluated since.". The reset notifies nobody and adds
no history entry, also when the alarm was in ALARM. Changing its name, addresses, webhook or
notifications does not reset it.
Prerequisites
- Permission for
monitoring:PutMetricAlarmon the alarm,rn:ews::<organization id>:monitoring:alarm/<alarm id>. - In the console, also
monitoring:DescribeAlarmsto open Alarms. Withoutmonitoring:PutMetricAlarmon an alarm, its notification switch is unavailable, with the note "Needs monitoring:PutMetricAlarm on this alarm."
Stop or resume notifications
With notifications stopped, the alarm keeps being evaluated and its state stays current; only the mail and the webhook stop.
- Open Monitoring, then Alarms.
- Open the alarm's action menu and choose Stop notifications, or Resume notifications for an alarm whose notifications are off.
The Notifies column shows off while they are stopped.
dcloud monitoring alarms update alarm-id --no-enabledPUT /monitoring/api/alarms/alarm-id
{ "enabled": false }Set enabled = false on the dcloud_monitoring_alarm.
Change the rule or the recipients
Not available in Console. The console only stops and resumes notifications; change the rest with the CLI, the API or Terraform.
dcloud monitoring alarms update alarm-id --threshold 90 --evaluation-periods 5PUT /monitoring/api/alarms/alarm-id
{ "threshold": 90, "evaluationPeriods": 5, "notifyEmails": ["ops@example.com", "oncall@example.com"] }notifyEmails replaces the list; "webhookUrl": null removes the webhook. Changing
resourceType without dimensions leaves the alarm with none.
Change the arguments of the dcloud_monitoring_alarm and apply.
When the change is refused
The alarm as it would be after the change is checked as a whole:
400"An alarm looks back at most one day (period × evaluation periods)" when the new period or evaluation periods, with the other's current value, pass one day; when the request sets both, the message starts "evaluationPeriods: ".400when the new metric is not recorded for the resource type,404"Resource not found" for a new resource your organization does not have.409"An alarm named "…" already exists" for a new name that is taken.404"Alarm not found" when your organization has no such alarm.