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 details 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 a Basic Alarm.

    1. Create a basic query on the Metrics Explorer page.
    2. If the query isn't open, open it by clicking Edit queries.
    3. To select a resource by using Basic mode (default), provide the following information.

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

      • 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 metric, see Listing Metric Definitions.
      • Dimension value: The value that you want to use for the specified dimension, for example, the resource identifier for an instance.
      • Additional dimension: Adds another name-value pair for a dimension.
    4. To select a resource by updating the MQL expression, follow these steps:
      1. Click Advanced mode.
      2. Edit the text in the Query code editor box.
    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> [...]

    For a complete list of parameters and values 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.