Updating an Alarm After Moving a Resource
Update an alarm in Monitoring after you move a monitored resource.
After you move a resource that's emitting metrics monitored by the alarm, update the metric compartment of related alarms. For example, if you move a block volume to another compartment, then the associated alarm must be updated if you want to continue monitoring metrics from the moved block volume.
Inherent policies in the destination compartment apply immediately and affect access to the moved resource through the Console. For more information about moving resources, see Moving a Resource Between Compartments.
For alarm troubleshooting, see Troubleshooting Alarms. See also Creating a Basic Alarm.
The alarm now monitors metrics from the new compartment. Use the oci monitoring alarm update command and required parameters to update an alarm to query metrics in the resource's new compartment. Ensure that the query doesn't specify the resource's old compartment.
oci monitoring alarm update --metric-compartment-id <resource_compartment_ocid> --query-text
<mql_expression_not_specifying_old_compartment>
[...]For a complete list of parameters and values for CLI commands, see the Command Line Reference for Monitoring.
Run the UpdateAlarm operation to update an alarm to query metrics in the resource's new compartment.
When defining details for UpdateAlarmDetails, set
metricCompartmentId
to the resource's new compartment, and ensure that the old compartment isn't specified inquery
.