Creating an Absence Alarm

Create an absence alarm in Monitoring to send notifications when a metric doesn't emit data for a specified interval.

The absent() statistic in an absence alarm returns 1 (true) when the metric is absent for the entire interval. After two hours of continuous 1 values, the statistic stops returning values. When the metric is present during the interval, the statistic returns 0 (false).

The following metric query has an absence alarm for a compute instance that's set on an interval of 1 minute:
CpuUtilization[1m]{resourceId = "<resource_identifier>"}.groupBy(resourceId).absent()

We recommend including groupBy in the query of the absence alarm. Using groupBy prevents irrelevant alarm triggers when OCI introduces new dimensions. A new dimension creates an initially empty metric stream.

With groupBy, the alarm monitors grouped metric streams only. The previous example query triggers the alarm when no metric streams exist for the instance. If OCI Compute adds a dimension to CpuUtilization, and other metric streams (from other dimensions) aren't absent, then the alarm isn't triggered.

Without groupBy, the alarm monitors all metric streams. For example, consider the query CpuUtilization[1m].absent(). If OCI Compute adds a dimension to CpuUtilization, then the alarm is triggered, regardless of the presence of other metric streams.

In the metric chart on the Create Alarm page, a dashed red line indicates the absence threshold. The following example shows a 1 value for a metric stream, which indicates that the compute instance corresponding to this metric stream didn't emit CpuUtilization metric data until 1:30.
Absent metric data in a graph, Create Alarm page.

For alarm troubleshooting, see Troubleshooting Alarms.

    1. Open the navigation menu and click Observability & Management. Under Monitoring, click Alarm Definitions.
    2. Click Create Alarm.
    3. In the Trigger rule section in the Create Alarm, configure the absence trigger:
      • Operator: Select absent.
      • Trigger delay minutes: Enter the number of minutes that the condition must be maintained before the alarm is in the firing state.

      Alternatively, click Switch to Advanced Mode to use MQL.

    4. (Optional) To prevent irrelevant alarm triggers when OCI introduces new dimensions (recommended):
      1. Go to the Metric dimensions area and provide the following values:
        • Dimension name: Select a qualifier that's specified in the metric definition. For example, the dimension resourceId is specified in the metric definition for CpuUtilization.
        • Dimension value: Select the value to use for the specified dimension. For example, if you selected resourceId as the dimension, select the resource identifier for the instance that you're monitoring.
      2. At the top of the page, click Switch to Advanced Mode.
        The query appears in Monitoring Query Language (MQL), in the Query code editor box. Example:
        CpuUtilization[1m]{resourceId = "<resource_identifier>"}.absent()
      3. In the Query code editor box, before .absent(), insert .groupBy(<dimension_name>).
        CpuUtilization[1m]{resourceId = "<resource_identifier>"}.groupBy(resourceId).absent()
    5. Provide values for the remaining fields.
      For reference, see Creating a Basic Alarm.
    6. Click Save alarm.
  • Use the oci monitoring alarm create command and required parameters to create a threshold alarm. For the required parameter --query-text, use an MQL expression that specifies an absence trigger rule:

    oci monitoring alarm create --query-text <mql_expression_specifying_absence_trigger_rule> [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the Command Line Reference for Monitoring.

  • Run the CreateAlarm operation to create an absence alarm.

    When defining details for CreateAlarmDetails, set query to an MQL expression that specifies an absence trigger rule.