Create a Query-based Widget for Resources

You can create a query-based widget using the Oracle Cloud Infrastructure resource queries to display and monitor resources.

One sample resource query is available in the query-based widget builder, which you can use to query and display all the resources in the widget. For more sample resource queries, see Sample Queries.

Note

To create a query-based widget that displays resources, you must have the required permission to at least inspect resource-types. For information, see Required IAM Permissions .

To create a query-based widget that displays resources:

  1. Go to the Dashboards page.
  2. Click Create dashboard to create a new dashboard or open an existing dashboard in edit mode.
  3. On the Widgets tab, click the Add widget group and widgets icon (Add widget group and widgets) and click Create query-based widget....
    The query-based widget builder is displayed.
  4. Select Resources in the Data source field.
  5. Use or edit the default query displayed in the Query field or enter a new query and click Run.

    The resources are displayed in a tabular format with resource-type and other details. Below the table chart, another table with the raw data returned by the query is displayed and you can click Hide raw data to hide it.

  6. Use the following tabs on the right side to perform tasks such as adding a name and description for the widget:
    Note

    You can click JSON in the upper-right corner to edit the JSON metadata of the widget directly. The JSON editor provides you with greater flexibility and more options to visualize data in the widget, however, it's recommended that you use it only if you're familiar with editing widget JSON. For more information on the JSON editor, contact Oracle Support.
    • About: Enter a name for the widget, select the compartment in which you want the widget to reside, and add a description for the widget.

      Optionally, click Show advanced options to add free-form or defined tags to the widget. If you have the permissions required to create a widget, then you also have permissions to add free-form tags. To add a defined tag, you must have permissions to use the tag namespace. For information on:

    • Visualization: Select a chart type and customize the visualization by specifying or modifying additional options. In a query-based widget for resources, as most of the data is textual, it's recommended that you use a Table chart. In a Table chart, you have the option of removing some of the columns or selecting the All columns check box to display all columns.

      For more information on the visualization options in a query-based widget builder, see About Visualization Options.

    • Settings: Review and edit widget inputs, if required.

      Optionally, add input parameters to make the widget reusable by supplying different values of that parameter. For example, input parameters can be configured to filter the data by a specific condition, where the value is supplied through the parameter. If you're using the following query to create a query-based widget for resources, you can add an input parameter for lifeCycleState and configure different values to view resources with the specified lifecycle state.

      query instance resources where lifeCycleState = '<input_parameter>'

      For more information on how to add input parameters, see step 9 in Create a Query-based Widget Using Metrics.

  7. Click Save to save the widget in the widget library and add it to the dashboard.