Building Metric Queries

This topic describes how to query metrics  for resources  of interest, create alarms  from a given query , and share Console charts.

Caution

Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.

Prerequisites

  • IAM policies: Querying metrics is part of monitoring. To monitor resources, you must be given the required type of access in a policy  written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. The policy must give you access to the monitoring services as well as the resources being monitored. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which compartment  you should work in. For more information on user authorizations for monitoring, see the Authentication and Authorization section for the related service: Monitoring or Notifications. For common policies that give groups access to metrics, see Let users view metric definitions in a compartment and Restrict user access to a specific metric namespace.
  • Metrics exist in Monitoring: The resources that you want to monitor must emit metrics to the Monitoring service.
  • Compute instances: To emit metrics, Compute instances must be monitoring-enabled. Oracle Cloud Agent software installation may also be required. For more information, see Enabling Monitoring for Compute Instances.

Working with Metric Queries

This section shows MQL  syntax of metric and alarm queries.

Use metric queries  to actively and passively monitor your cloud resources. Actively monitor with metric queries that you generate spontaneously, on demand. In the Console, update a chart to show data from multiple queries. Store queries you want to reuse. Passively monitor with alarms that add a condition, or trigger rule, to a metric query.

Metric query syntax (boldface elements are required): 

metric[interval]{dimensionname=dimensionvalue}.groupingfunction.statistic

Threshold Alarm query syntax (boldface elements are required): 

metric[interval]{dimensionname=dimensionvalue}.groupingfunction.statistic alarmoperator alarmvalue

For supported parameter values, see Monitoring Query Language (MQL) Reference.

For background information on metrics in Oracle Cloud Infrastructure, see Metrics Feature Overview.

Example queries

Simple metric query

Maximum CPU Utilization at a one-minute interval.

Number of lines displayed in the metric chart (Console): 1 per resource.

CpuUtilization[1m].max()

Filtered metric query

Maximum CPU Utilization at a one-minute interval, filtered to a single resource.

Number of lines displayed in the metric chart (Console): 1.

CpuUtilization[1m]{resourceId="ocid1.instance.oc1.phx.exampleuniqueID"}.max()

Aggregated metric query

All IopsRead at a one-minute interval, filtered to a compartment, aggregated for the maximum.

Number of lines displayed in the metric chart (Console): 1.

IopsRead[1m]{compartmentId="ocid1.compartment.oc1.phx..exampleuniqueID"}.grouping().max()

Group-aggregated metric query

Aggregated average of CPU Utilization by availability domain and pool ID, filtered to Compute instances that use the specified shape.

Number of lines displayed in the metric chart (Console): 1 per pool and 1 per availability domain.

CPUUtilization[1m]{shape="VM.Standard2.8"}.groupBy(availabilityDomain,poolId).mean()

Alarm query (threshold)

Triggered when the 90th percentile of CPU Utilization, aggregated by pool ID, and filtered to the specified availability domain, exceeds 85.

Number of lines displayed in the metric chart (Console): 1 per pool.

CpuUtilization[1m]{availabilityDomain="VeBZ:PHX-AD-1"}.groupBy(poolId).percentile(0.9) > 85

Grouped count of resources (alarm query or metric query)

Note

Nested alarm queries are not currently supported in the Console. Use the API to create alarms with nested queries.

An example of a nested query is a grouped count of hosts with up time greater than zero, where the alarm query to identify these hosts is defined within parentheses:

(metric[1h].groupBy(host).min() > 0).grouping().count()

You can use such a query to either define an alarm or query a metric.

Using the Console

To create a query
  1. Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.

    The Metrics Explorer page displays an empty chart with fields to build a query.

  2. Fill in the fields for a new query.
    • Compartment: The compartment containing the resources that you want to monitor. By default, the first accessible compartment is selected.
    • Metric Namespace: The service or application emitting metrics for the resources that you want to monitor.
    • Resource Group (optional): The group that the metric belongs to. A resource group is a custom string provided with a custom metric. Not applicable to service metrics.
    • Metric Name: The name of the metric. Only one metric can be specified. Metric selections depend on the selected compartment and metric namespace. Example: CpuUtilization
    • Interval: The aggregation window.

      Interval values

      Supported values for interval depend on the specified time range in the metric query (not applicable to alarm queries). More interval values are supported for smaller time ranges. For example, if you select one hour for the time range, then all interval values are supported. If you select 90 days for the time range, then only the 1h or 1d interval values are supported.

      • 1m - 1 minute
      • 5m - 5 minutes
      • 1h - 1 hour
      • 1d - 1 day
      Note

      For metric queries, the interval  you select drives the default resolution  of the request, which determines the maximum time range of data returned.

      For more information about the resolution parameter as used in metric queries, see SummarizeMetricsData.

      Maximum time range returned for a query

      The maximum time range returned for a metric query depends on the resolution. By default, for metric queries, the resolution is the same as the query interval.

      The maximum time range is calculated using the current time, regardless of any specified end time. Following are the maximum time ranges returned for each interval selection available in the Console (Basic Mode). To specify an interval value that is not available in Basic Mode in the Console, such as 12 hours, switch to Advanced Mode.

      Interval Default resolution (metric queries) Maximum time range returned
      1d 1 day 90 days
      1h 1 hour 90 days
      5m 5 minutes 30 days
      1m 1 minute 7 days

      To specify a non-default resolution that differs from the interval, use the SummarizeMetricsData operation.

      See examples of returned data

      Example 1: One-minute interval and resolution up to the current time, sent at 10:00 on January 8th. No resolution or end time is specified, so the resolution defaults to the interval value of 1m, and the end time defaults to the current time (2019-01-08T10:00:00.789Z). This request returns a maximum of 7 days of metric data points. The earliest data point possible within this seven-day period would be 10:00 on January 1st (2019-01-01T10:00:00.789Z).

      Example 2: Five-minute interval with one-minute resolution up to two days ago, sent at 10:00 on January 8th. Because the resolution drives the maximum time range, a maximum of 7 days of metric data points is returned. While the end time specified was 10:00 on January 6th (2019-01-06T10:00:00.789Z), the earliest data point possible within this seven-day period would be 10:00 on January 1st (2019-01-01T10:00:00.789Z). Therefore, only 5 days of metric data points can be returned in this example.

    • Statistic: The aggregation function.

      Statistic values
      • COUNT- The number of observations received in the specified time period.
      • MAX - The highest value observed during the specified time period.
      • MEAN - The value of Sum divided by Count during the specified time period.
      • MIN - The lowest value observed during the specified time period.
      • P50 - The value of the 50th percentile.
      • P90 - The value of the 90th percentile.
      • P95 - The value of the 95th percentile.
      • P99 - The value of the 99th percentile.
      • P99.5 - The value of the 99.5th percentile.
      • RATE - The per-interval average rate of change.
      • SUM - All values added together.
    • Metric dimensions: Optional filters to narrow the metric data evaluated.

      Dimension fields
      • Dimension Name: A qualifier specified in the metric definition. For example, the dimension resourceId is specified in the metric definition for CpuUtilization.

        Note

        Long lists of dimensions are trimmed.

        • To view dimensions by name, type one or more characters in the box. A refreshed (trimmed) list shows matching dimension names.
        • To retrieve all dimensions for a given metric, use the following API operation: ListMetrics
      • Dimension Value: The value you want to use for the specified dimension. For example, the resource identifier for your instance of interest.
      • + Additional dimension: Adds another name-value pair for a dimension.
    • Aggregate Metric Streams: Aggregates all results to plot a single aggregated average for all metric streams. This average is plotted as a single line on the metric chart. This operation is helpful when you want to plot a metric as one line for all resources.
  3. Click Update Chart.

    The chart shows the results of your new query. Very small or large values are indicated by International System of Units (SI units), such as M for mega (10 to the sixth power). Units correspond to the selected metric and do not change by statistic.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
  4. To customize the y-axis label or range, type the label you want into Y-Axis Label or type the minimum and maximum values you want into Y-Axis Min Value and Y-Axis Max Value.

    Only numeric characters are allowed for custom ranges. Custom labels and ranges are not persisted in shared queries (MQL).

  5. To view the query as a Monitoring Query Language (MQL) expression, click Advanced Mode.

    Advanced Mode is located on the right, under the chart.

    Use Advanced Mode to edit your query using MQL syntax to aggregate results by group. The MQL syntax also supports additional parameter values. For more information about query parameters in Basic Mode and Advanced Mode, see Monitoring Query Language (MQL) Reference.

  6. To create another query, click Add Query below the chart.
To change the time range

Supported values for interval depend on the specified time range in the metric query (not applicable to alarm queries). More interval values are supported for smaller time ranges. For example, if you select one hour for the time range, then all interval values are supported. If you select 90 days for the time range, then only the 1h or 1d interval values are supported.

For metric queries, the interval  you select drives the default resolution  of the request, which determines the maximum time range of data returned.

For more information about the resolution parameter as used in metric queries, see SummarizeMetricsData.

Maximum time range returned for a query

The maximum time range returned for a metric query depends on the resolution. By default, for metric queries, the resolution is the same as the query interval.

The maximum time range is calculated using the current time, regardless of any specified end time. Following are the maximum time ranges returned for each interval selection available in the Console (Basic Mode). To specify an interval value that is not available in Basic Mode in the Console, such as 12 hours, switch to Advanced Mode.

Interval Default resolution (metric queries) Maximum time range returned
1d 1 day 90 days
1h 1 hour 90 days
5m 5 minutes 30 days
1m 1 minute 7 days

To specify a non-default resolution that differs from the interval, use the SummarizeMetricsData operation.

See examples of returned data

Example 1: One-minute interval and resolution up to the current time, sent at 10:00 on January 8th. No resolution or end time is specified, so the resolution defaults to the interval value of 1m, and the end time defaults to the current time (2019-01-08T10:00:00.789Z). This request returns a maximum of 7 days of metric data points. The earliest data point possible within this seven-day period would be 10:00 on January 1st (2019-01-01T10:00:00.789Z).

Example 2: Five-minute interval with one-minute resolution up to two days ago, sent at 10:00 on January 8th. Because the resolution drives the maximum time range, a maximum of 7 days of metric data points is returned. While the end time specified was 10:00 on January 6th (2019-01-06T10:00:00.789Z), the earliest data point possible within this seven-day period would be 10:00 on January 1st (2019-01-01T10:00:00.789Z). Therefore, only 5 days of metric data points can be returned in this example.

  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. To select a period of time, such as Last hour, click Start Time or End Time.
  3. To enter a time value, click in Start Time or End Time and then type a value.
To filter results

Filter results to limit the data plotted on the metric chart. For example, filter results to a resource or pool of interest.

Filtering is done through selected dimensions ; available dimensions vary by metric.

You can also match resource groups provided with the metric. Blank (null) for resource group returns metric data that does not have a resource group.

To filter by dimensions
  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit query icon.
  3. Under Metric dimensions, select a Dimension Name and Dimension Value.

    Dimension fields
    • Dimension Name: A qualifier specified in the metric definition. For example, the dimension resourceId is specified in the metric definition for CpuUtilization.

      Note

      Long lists of dimensions are trimmed.

      • To view dimensions by name, type one or more characters in the box. A refreshed (trimmed) list shows matching dimension names.
      • To retrieve all dimensions for a given metric, use the following API operation: ListMetrics
    • Dimension Value: The value you want to use for the specified dimension. For example, the resource identifier for your instance of interest.
    • + Additional dimension: Adds another name-value pair for a dimension.
  4. To add a dimension name-value pair, click + Additional dimension.

  5. Click Update Chart.

    The chart shows the filtered results of your query.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
  6. To view the query as a Monitoring Query Language (MQL) expression, click Advanced Mode.

    The dimension name-value fragment appears after the metric-interval fragment.

    In the following example query, the dimension name-value fragment is {resourceId="ocid1.instance.oc1.phx.exampleuniqueID"}, which filters results by the specified resource identifier.

    CpuUtilization[1m]{resourceId="ocid1.instance.oc1.phx.exampleuniqueID"}.max()

    The MQL  syntax supports more parameter values. See Monitoring Query Language (MQL) Reference.

To match resource group

You can match resource groups provided with the metric.

Note

Blank (null) for resource group returns metric data that does not have a resource group.
  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit query icon.
  3. Select the Resource Group you want to use as a filter.
  4. Click Update Chart.

    The chart shows query results that match the resource group.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
To aggregate all results

Aggregate all results to plot a single aggregated average for all metric streams . This average is plotted as a single line on the metric chart. This operation is helpful when you want to plot a metric as one line for all resources.

  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit query icon.
  3. Click Aggregate Metric Streams.
  4. Click Update Chart.

    The chart shows the results of your query.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
  5. To view the query as a Monitoring Query Language (MQL) expression, click Advanced Mode.

    The grouping() function appears before the statistic. For example, the following query returns the maximum (max()) IopsRead metric data at a one-minute interval, filtered to a compartment, with all results aggregated.

    IopsRead[1m]{compartmentID = "<compartment_OCID>"}.grouping().max()

    Edit your query in MQL  to aggregate results by group. The MQL syntax also supports more parameter values. See Monitoring Query Language (MQL) Reference.

To aggregate results by group
Note

Aggregating query results by group requires the groupBy() function, which is available in Advanced Mode only.

Aggregate query results by group to plot group-specific aggregated averages. Each group's average is plotted as a single line on the metric chart. This operation is helpful when you want to identify trends by group rather than individual resource.

For example, the following query returns the average (mean()) CPU Utilization metric data at a one-minute interval. Results are filtered to the specified shape  and grouped by availability domain . If you have Compute instances of this shape sending metrics across three availability domains, then three lines are plotted on the metric chart.

CPUUtilization[1m]{shape="VM.Standard1.1"}.groupBy(availabilityDomain).mean()

You can also aggregate by resource groups when provided with the metric (groupBy(resourceGroup)).

  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit query icon.
  3. Select Advanced Mode below the chart on the right.
  4. In the Query Code Editor box, insert the groupBy({dimension}) function between the metric-interval fragment and the statistic, where {dimension} is the name of a dimension provided in the definition of the indicated metric.

    For example, insert the following fragment to group by availability domain, assuming that the dimension is available for the selected metric.

    groupBy(availabilityDomain)

    The MQL  syntax supports more parameter values. See Monitoring Query Language (MQL) Reference.

  5. Click Update Chart.

    The chart is updated to show a single line for each grouped result.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
To edit a query using MQL syntax

Edit your query using MQL  syntax to aggregate results by group or for more parameter values. See Monitoring Query Language (MQL) Reference.

  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit Query icon.
  3. Click Advanced Mode.

    The query is displayed as a Monitoring Query Language (MQL) expression.

  4. In the Query Code Editor box, edit the query as needed.

  5. Click Update Chart.

    The chart is updated.

    Troubleshooting Errors and Query Limits

    If you see an error that the query has exceeded the maximum number of metric streams , then update the query to evaluate a number of metric streams that is within the limit. For example, you can reduce the metric streams by specifying dimensions. You can continue to evaluate all metric streams that were in the original query by spreading the metric streams across multiple queries (or alarms).

    Limits information for returned data includes the 100,000 data point maximum and time range maximums (determined by resolution, which relates to interval). See MetricData Reference.
To create an alarm from a query

Create an alarm to passively monitor for a condition in results from metric queries. Creating an alarm from a query involves adding a trigger rule to the query and setting up notifications.

  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit Query icon.

  3. Click Create Alarm.
  4. On the Create Alarm page, under Define alarm, add the trigger, and fill in or update other alarm settings as needed:

    Alarm settings
    Basic Mode (default)

    By default, this page uses Basic Mode, which separates the metric from its dimensions and its trigger rule.

    • Alarm Name

      User-friendly name for the new alarm. This name is sent as the title for notifications related to this alarm.

      Rendering of the title by protocol
      Protocol Rendering of the title
      Email Subject line of the email message.
      HTTPS (Custom URL) Not rendered.
      PagerDuty Title field of the published message.
      Slack Not rendered.
    • Alarm Severity: The perceived type of response required when the alarm is in the firing state.
    • Alarm Body: The human-readable content of the notification delivered. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Example: "High CPU usage alert. Follow runbook instructions for resolution."
    • Tags (optional): If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, then skip this option (you can apply tags later) or ask your administrator.
    • Metric description: The metric to evaluate for the alarm condition.
      • Compartment: The compartment  containing the resources that emit the metrics evaluated by the alarm. The selected compartment is also the storage location of the alarm. By default, the first accessible compartment is selected.
      • Metric Namespace: The service or application emitting metrics for the resources that you want to monitor.
      • Resource Group (optional): The group that the metric belongs to. A resource group is a custom string provided with a custom metric. Not applicable to service metrics.
      • Metric Name: The name of the metric. Only one metric can be specified. Example: CpuUtilization
      • Interval: The aggregation window, or the frequency at which data points are aggregated.

        Interval values
        Note

        Valid alarm intervals depend on the frequency at which the metric is emitted. For example, a metric emitted every five minutes requires a 5-minute alarm interval or higher. Most metrics are emitted every minute, which means most metrics support any alarm interval. To determine valid alarm intervals for a given metric, check the relevant service's metric reference.
        • 1m - 1 minute
        • 5m - 5 minutes
        • 1h - 1 hour
        • 1d - 1 day
        Note

        For alarm queries, the specified interval  has no effect on the resolution  of the request. The only valid value of the resolution for an alarm query request is 1m. For more information about the resolution parameter as used in alarm queries, see Alarm.

      • Statistic: The aggregation function.

        Statistic values
        • COUNT- The number of observations received in the specified time period.
        • MAX - The highest value observed during the specified time period.
        • MEAN - The value of Sum divided by Count during the specified time period.
        • MIN - The lowest value observed during the specified time period.
        • P50 - The value of the 50th percentile.
        • P90 - The value of the 90th percentile.
        • P95 - The value of the 95th percentile.
        • P99 - The value of the 99th percentile.
        • P99.5 - The value of the 99.5th percentile.
        • RATE - The per-interval average rate of change.
        • SUM - All values added together.
    • Metric dimensions: Optional filters to narrow the metric data evaluated.

      Dimension fields
      • Dimension Name: A qualifier specified in the metric definition. For example, the dimension resourceId is specified in the metric definition for CpuUtilization.

        Note

        Long lists of dimensions are trimmed.

        • To view dimensions by name, type one or more characters in the box. A refreshed (trimmed) list shows matching dimension names.
        • To retrieve all dimensions for a given metric, use the following API operation: ListMetrics
      • Dimension Value: The value you want to use for the specified dimension. For example, the resource identifier for your instance of interest.
      • + Additional dimension: Adds another name-value pair for a dimension.
    • Trigger rule: The condition that must be satisfied for the alarm to be in the firing state. The condition can specify a threshold, such as 90% for CPU Utilization, or an absence.

      • Operator: The operator used in the condition threshold.

        Operator values
        • greater than
        • greater than or equal to
        • equal to
        • less than
        • less than or equal to
        • between (inclusive of specified values)
        • outside (inclusive of specified values)
        • absent
      • Value: The value to use for the condition threshold.
      • Trigger Delay Minutes: The number of minutes that the condition must be maintained before the alarm is in firing state.
    Advanced Mode

    Click Advanced Mode or Switch to Advanced Mode to view the alarm query as a Monitoring Query Language (MQL) expression. Edit your query using MQL syntax to aggregate results by group or for additional parameter values. See Monitoring Query Language (MQL) Reference.

    • Alarm Name

      User-friendly name for the new alarm. This name is sent as the title for notifications related to this alarm.

      Rendering of the title by protocol
      Protocol Rendering of the title
      Email Subject line of the email message.
      HTTPS (Custom URL) Not rendered.
      PagerDuty Title field of the published message.
      Slack Not rendered.
    • Alarm Severity: The perceived type of response required when the alarm is in the firing state.
    • Alarm Body: The human-readable content of the notification delivered. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Example: "High CPU usage alert. Follow runbook instructions for resolution."
    • Tags (optional): If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, then skip this option (you can apply tags later) or ask your administrator.
    • Metric description, dimensions, and trigger rule: The metric to evaluate for the alarm condition, including dimensions and the trigger rule.

      • Compartment: The compartment  containing the resources that emit the metrics evaluated by the alarm. The selected compartment is also the storage location of the alarm. By default, the first accessible compartment is selected.
      • Metric Namespace: The service or application emitting metrics for the resources that you want to monitor.
      • Resource Group (optional): The group that the metric belongs to. A resource group is a custom string provided with a custom metric. Not applicable to service metrics.
      • Query Code Editor box: The alarm query as a Monitoring Query Language (MQL) expression.

        Note

        Valid alarm intervals depend on the frequency at which the metric is emitted. For example, a metric emitted every five minutes requires a 5-minute alarm interval or higher. Most metrics are emitted every minute, which means most metrics support any alarm interval. To determine valid alarm intervals for a given metric, check the relevant service's metric reference.

        Example alarm query: 

        CpuUtilization[1m]{availabilityDomain=AD1}.groupBy(poolId).percentile(0.9) > 85

        For query syntax and examples, see Working with Metric Queries.

      • Trigger Delay Minutes: The number of minutes that the condition must be maintained before the alarm is in firing state.

    The chart below the Define alarm section dynamically displays the last six hours of emitted metrics according to currently selected fields for the query. Very small or large values are indicated by International System of Units (SI units), such as M for mega (10 to the sixth power).

  5. Under Notifications, select or create at least one notification destination: 

    Notifications settings
    • Destinations
      • Destination Service: The provider of the destination to use for notifications.

        Available options: 

      • Compartment: The compartment  storing the topic to be used for notifications. Can be a different compartment from the alarm and metric. By default, the first accessible compartment is selected.
      • Topic: The topic to use for notifications. Each topic supports a subscription protocol, such as PagerDuty.
      • Create a topic: Sets up a topic and subscription protocol in the selected compartment, using the specified destination service.

        • Topic Name: User-friendly name for the new topic. Example: "Operations Team " for a topic used to notify operations staff of firing alarms.
        • Topic Description: Description of the new topic.
        • Subscription Protocol: Medium of communication to use for the new topic. Configure your subscription for the protocol you want: 

          Email subscription

          Sends an email message when you publish a message  to the subscription's parent topic .

          • Subscription Protocol: Select Email.
          • Subscription Email: Type an email address.
          HTTPS (Custom URL) subscription

          Sends specified information when you publish a message  to the subscription's parent topic .

          Endpoint format (URL using HTTPS protocol): 

          https://<anyvalidURL>
          Basic access authentication is supported, allowing you to specify a username and password in the URL, as in https://user:password@domain.com or https://user@domain.com. The username and password are encrypted over the SSL connection established when using HTTPS. For more information about Basic Access Authentication, see RFC-2617.
          Query parameters are not allowed in URLs.
          • Subscription Protocol: Select HTTPS (Custom URL).
          • Subscription URL: Type (or copy and paste) the URL you want to use as the endpoint.
          PagerDuty subscription

          Creates a PagerDuty incident by default when you publish a message  to the subscription's parent topic .

          Endpoint format (URL): 

          https://events.pagerduty.com/integration/<integrationkey>/enqueue
          Query parameters are not allowed in URLs.

          To create an endpoint for a PagerDuty subscription (set up and retrieve an integration key), see the PagerDuty documentation.

          • Subscription Protocol: Select PagerDuty.
          • Subscription URL: Type (or copy and paste) the integration key portion of the URL for your PagerDuty subscription. (The other portions of the URL are hard-coded.)
          Slack subscription

          Sends a message to the specified Slack channel by default when you publish a message  to the subscription's parent topic .

          Endpoint format (URL): 

          https://hooks.slack.com/services/<webhook-token>

          The <webhook-token> portion of the URL contains two slashes (/).

          Query parameters are not allowed in URLs.

          To create an endpoint for a Slack subscription (using a webhook for your Slack channel), see the Slack documentation.

          • Subscription Protocol: Select Slack.
          • Subscription URL: Type (or copy and paste) the Slack endpoint, including your webhook token.
      • + Additional destination service: Adds another destination service and topic to use for notifications.

        Note

        Each alarm is limited to one destination per supported destination service.
    • Repeat Notification?: While the alarm is in the firing state, resends notifications at the specified interval.
    • Notification Interval: The period of time to wait before resending the notification.
    • Suppress Notifications: Sets up a suppression time window during which to suspend evaluations and notifications. Useful for avoiding alarm notifications during system maintenance periods.

      • Suppression Description
      • Start Time
      • End Time
  6. If you want to disable the new alarm, clear Enable This Alarm?.
  7. Click Save alarm.

    The new alarm is listed on the Alarm Definitions page.

    For more information about alarms, see Alarms Feature Overview.

To hide a query from the chart
  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. Click the Toggle query on chart icon for the query that you want to hide.
To share a query
  1. View the Metrics Explorer page: Open the navigation menu. Under Solutions and Platform, go to Monitoring and click Metrics Explorer.
  2. If necessary, open the query for editing: Click the Edit query icon.
  3. Click Advanced Mode.
  4. In the Query Code Editor box, copy the query.