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.
Use the oci monitoring metric-data summarize-metrics-data command and required parameters to query metric data. Use the
--query-textparameter 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
queryattribute to select resource-specific dimensions (part of the MQL expression). For an example, see SummarizeMetricsDataDetails.