Creating a Custom Query-based Widget

You can create a custom query-based widget and add it to a new or existing dashboard.

Before you create a widget, you must ensure that you have the CREATE_SAVED_SEARCHES privilege. An Enterprise Manager Super Administrator can grant the CREATE_SAVED_SEARCHES privilege to a user or role using the emcli grant_privs command. Alternatively, a Super Administrator can grant the Create Saved Searches privilege using the Saved Searches resource type in the Security user interface.

Other prerequisites for creating query-based widgets include a working knowledge of:

  • SQL queries and how to create and edit them
  • Oracle Enterprise Manager Management Repository views

The SQL query retrieves the data you want to view in the widget from an Enterprise Manager Management Repository view. These views provide access to target, metric, and monitoring information stored in the Management Repository. For information on Management Repository views, see About Management Repository Views in Oracle Enterprise Manager Management Repository Views Reference.

To access the widget builder to create a custom query-based widget:

  1. Navigate to the Dashboards page.
  2. Click Create Dashboard or open an existing dashboard in edit mode.
  3. In the Widgets tab, under Add widgets, click the Add widget group and widgets icon (Add widget group and widgets), and then click Create query-based widget.

    A blank untitled widget is displayed in the widget builder.

You can use the following types of SQL queries as input to create a query-based widget:

  • Custom SQL: Use the sample custom SQL query, edit it, or replace it with a new query to create a widget that meets your specific requirements. For more information, see Creating a Widget Using Custom SQL.

    Note:

    If creating a widget using custom SQL, you can also select EM Federation as the data source and the SQL query then retrieves the data from federated Enterprise Manager sites. For information on configuring Enterprise Manager Federation, see Configuring Enterprise Manager Federation in Oracle Enterprise Manager Advanced Installation and Configuration Guide.
  • Predefined SQL: Select from the out-of-the-box named SQL queries, which display the requested data in the widget. For more information, see Creating a Widget Using Predefined SQL.

On specifying the input to the widget in the widget builder, use the available visualization options to display data to support various scenarios.

Note:

  • Only custom query-based widgets can be edited in the widget builder.
  • Any changes made to a custom query-based widget will impact its use in all the dashboards of which it is a part. For example, if a custom query-based widget is used in two dashboards and the widget is edited in one of the dashboards and changes are made to the parameter configuration, then this may result in the widget not displaying any data in the other dashboard.

You can allow other Enterprise Manager users to view or edit the widget you have created. To grant the required privileges, use the emcli grant_privs command and the SavedSearchID, which is a part of the saved search metadata identified by the "id" attribute. The privilege levels include:

  • VIEW_SAVED_SEARCH: Allows a user to view the saved search.
  • EDIT_SAVED_SEARCH: Allows a user to view and edit the saved search.
  • FULL_SAVED_SEARCH: Allows a user to view, edit, and delete the saved search.

Here is an example of the EMCLI command:

$ emcli grant_privs -name="<USER>" -privilege="EDIT_SAVED_SEARCH;SAVED_SEARCH_ID=<SavedSearchID>"