Creating a Query
Define a query to retrieve data from Monitoring.
For an example query, see Example Query and Metric Chart.
For query troubleshooting, see Troubleshooting Queries.
These steps show how to create a query in the Metrics Explorer page, in Basic mode. To create a query in Advanced mode (MQL), see Editing the MQL Expression for a Query.
For information about directly editing MQL expressions or changing queries by using the CLI or API, see Editing the MQL Expression for a Query.
Use the oci monitoring metric-data summarize-metrics-data command and required parameters to query metric data:
oci monitoring metric-data summarize-metrics-data [OPTIONS]
When specifying a dimension value within the query (
--query-text
), surround it with double quotes, and escape each double quote with a backslash character (\
). Example:oci monitoring metric-data summarize-metrics-data --compartment-id <compartment_OCID> --namespace oci_computeagent --query-text "CpuUtilization[1m]{resourceId = \"<instance_OCID>\"}.max()"
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.