Specifying a Predicate in a Query
Specify a predicate for querying metric data in Monitoring.
While typically used with alarms, you can also use predicates in queries for custom metric charts.
For valid predicate operators in MQL expressions, see Predicate Operators.
For query troubleshooting, see Troubleshooting Queries.
- Example 1: Mean CPU Utilization Greater than 80 Percent (Threshold Predicate)
-
CpuUtilization[1m].mean() > 80
- Example 2: Mean CPU Utilization Between 60 and 80 Percent (Threshold Predicate)
-
CpuUtilization[1m].mean() in (60, 80)
- Example 3: Errors Greater than 1 (Threshold Predicate)
-
ServiceConnectorHubErrors[1m].count() > 1
- Example 4: 90th Percentile CPU Utilization Greater than 85 (Threshold Predicate, Selecting an Availability Domain and Grouping by Pool)
-
CpuUtilization[1m]{availabilityDomain="VeBZ:PHX-AD-1"}.groupBy(poolId).percentile(0.9) > 85
- Example 5: No CPU Utilization Metrics Emitted (Absence Predicate)
-
CpuUtilization[1m]{resourceId = "<resource_identifier>"}.groupBy(resourceId).absent()
This section describes how to specify a predicate in a query on the Metrics Explorer page. On this page, predicates are available in Advanced mode (MQL) only. 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-text
parameter to specify a predicate (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 specify a predicate (part of the MQL expression). For an example, see SummarizeMetricsDataDetails.