Selecting a Resource for a Query

Limit returned metric data to a resource by selecting a resource-specific dimension when querying metric data in Monitoring.

Available dimensions  vary by metric.

This page describes how to query metrics from a resource through resource-specific dimensions. You can also access resource-specific metric charts by going to the resource's detail page in the Console. See Viewing Default Metric Charts for a Single Resource.

For query troubleshooting, see Troubleshooting Queries.

Examples

Example 1: Selecting a Resource by Name
DiskIopsWritten[1m]{resourceDisplayName = "wordpress"}.rate()
Example 2: Selecting a Resource by OCID
DiskIopsWritten[1m]{resourceId = "ocid1.instance.oc1.phx.exampleuniqueID"}.rate()
  • This section describes how to select a resource on the Metrics Explorer page by selecting a resource-specific dimension. For alarm query edits, see Creating an Alarm.

    1. Create a basic query on the Metrics Explorer page.
    2. If necessary, open the query for editing: Click Edit queries.
    3. To select a resource using Basic mode (default), fill in the fields for dimensions.

      Additional dimension fields appear for some metric namespaces. See the service-specific documentation for details. For example, a deployment type field appears for the metric namespace oci_autonomous_database.

      Field Description
      Dimension name

      A qualifier specified in the metric definition. For example, the dimension resourceId is specified in the metric definition for CpuUtilization.

      To select a specific resource within the selected compartment, filter results by a resource-specific dimension, such as resourceDisplayName.

      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, see Listing Metric Definitions.
      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.
      X Removes the indicated name-value pair for a dimension.
    4. To select a resource by updating the MQL expression, do the following.
      1. Click Advanced mode.
      2. Edit the text in Query code editor.
    5. Click Update Chart.
  • Use the oci monitoring metric-data summarize-metrics-data command and required parameters to query metric data. Use the --query-text parameter to select resource-specific dimensions (part of the MQL expression).

    oci monitoring metric-data summarize-metrics-data [...] --query-text <mql_expression> [OPTIONS]

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

  • Run the SummarizeMetricsData operation to query metric data. Use the query attribute to select resource-specific dimensions (part of the MQL expression). For an example, see SummarizeMetricsDataDetails.