You can use the Metric dimension filter to specify an
Oracle Cloud Infrastructure Monitoring service metric input to a widget.
The Metric dimension filter can be used to filter
metric data by dimension values. A common scenario for the use of this filter would
be to add it as an additional input parameter to supply different dimension values
to a query-based widget, and reuse the widget.
Here's an example in which the Metric dimension
filter is added as an additional input to a query-based Database Management widget
that uses metrics. For the purpose of this example, the
oracle_oci_database
namespace, the
CpuUtilization
metric, and the resourceName
dimension are being used. Note that this example does not detail all the fields and
options available in the query-based widget builder. For more information, see Create a Query-based Widget Using Metrics.
- Go to the Dashboards page.
- Click Create dashboard to create a new dashboard or open
an existing dashboard in edit mode.
- On the Filters tab, enter Metric dimension in the
search field and click the Metric dimension filter to add
it to the dashboard.
While adding the filter, specify the following details in the
Configure <name> input for Metric dimension
(required) dialog boxes:
- Namespace: Select
oracle_oci_database
.
- Metric name: Select
CpuUtilization
.
- Dimension name: Select
resourceName
.
Note
The Metric
dimension filter also requires the compartment input to
determine which compartment the metric resides in, however, the compartment
input is automatically configured to use the
Compartment filter. You can make changes to the
automatically configured input, if required.
- From the Metric dimension filter drop-down list in the
dashboard, select a database resource in the compartment.
- On the Widgets tab, click the Add widget group and
widgets icon () and click Create query-based widget....
The query-based widget builder is displayed.
- Click the Open/close filter panel icon () to confirm that the Metric dimension and
Compartment filters are added.
- Select Monitoring in the Data
source field.
- Specify the following Monitoring service metric details:
- Namespace: Select the namespace you
selected in the Metric dimension filter,
oracle_oci_database
.
- Query: Edit the default query
displayed in this field or enter a brand new query to retrieve the
CpuUtilization
metric information.
- Click Run.
- Perform the following steps to add an additional input parameter and link it to
the Metric dimension filter:
- On the Settings tab, click
Add input +.
- In the Configure input for untitled widget
(optional) dialog box:
- Input name: Enter a name for
the input parameter, for example,
resourceName. Note that the input
name is required when adding a placeholder expression to the
query.
- Input label: Enter a display
name for the input. The input name is displayed in this field by
default and you can change it to make it more
user-friendly.
- Configure widget input:
Select Link the input with an existing
filter and link the input parameter to the
Metric dimension filter.
- Edit the query and add a placeholder to display the data from the
Metric dimension filter in the widget, using the
following expression:
{<dimension>=$(params.<input_name>)}
For the purpose of this example, here's what the placeholder will look like
in the query:
CpuUtilization[auto]{resourceName=$(params.resourcename)}.mean()
- On the About tab, enter a name for the widget, select
the compartment in which you want the widget to reside, and add a description
for the widget.
- On the Visualization tab, select a chart type and
customize the visualization by specifying or modifying additional options.
- Click Save to save the widget in the widget library and
add it to the dashboard.
Once the query-based widget is added to the dashboard and the widget library, you
can change the dimension value for the resourceName
dimension in the
Metric dimension filter to view the
CpuUtilization
metric for different database resources.