Queries
Queries is a standard configuration interface for adding, editing, and removing stored queries from Unified Assurance.
Refer to the Standard Configuration Interface guide for details on interacting with the grid and form. The additional control is explained in the Grid Details section.
This user interface calls REST methods from api/database/queries.
The UI path for this interface is Configuration -> Databases -> Queries.
Caution:
It is possible to delete data with malformed queries. Be careful when using this interface.
Grid Details
The interface displays the standard Unified Assurance buttons as well as the following:
- Execute - After an existing query has been selected, click Execute to open a new browser tab with the query being run.
Form Fields
-
Name - The name for the stored query.
-
Description - The description of the stored query.
-
Schema - The schema to be used when running the stored query.
-
ShardID - The shard to be used when running the stored query.
-
User Owner - The user owner of the query.
-
Group Owner - The user group owner of the query.
-
Query - The query to be run.
-
Tokens - The optional tokens used for queries with placeholders. The Token is a reference for the value replacement that can be done when using the query via a dashboard and in other places. The Default Value is what will be used if no other value is supplied to the query when run.
-
Viewers - Selection of user groups that have read-only access to the query.
For details about User Owner, Group Owner and Viewers, see Configuring Ownership and Viewer Access in Unified Assurance Security Guide.
Query Toolbar
-
Line Numbers - Toggle on/off line numbers.
-
Search - Search code.
-
Previous - Previous result for current search.
-
Next - Next result for current search.
-
Replace One - Search and replace code.
-
Replace All - Search and replace all in code.
Token Value Replacement Example
-
Create a database query named Devices in Zone with placeholders.
-
Query Name => Devices in Zone
-
Schema => Assure1
-
ShardID => 1
-
Query User Owner => [Public to All Users In Group]
-
Query Group Owner => [Public to All Groups]
-
Query
SELECT DeviceID, DeviceName, INET_NTOA(IPAddress) AS IPAddress, INET6_NTOA(IPv6Address) AS IPv6Address FROM Devices WHERE DeviceZoneID = ?
-
Tokens => Click the "Add" button, then set the following:
Token Default Value Zone 1 -
Click on the "Submit" button.
-
-
Go to the Dashboards UI.
-
Click the Add button, then set the following:
- Name => Devices in Zone
-
Add a "database -> Database Grid" panel to the dashboard.
-
Click the "Configure Panel" button, then set the following:
-
Panel Name => Device List in Zone
-
Query => Devices in Zone
-
Click on the "View" button.
-
-
Click on the "Submit" button.
Note:
The following reserved words cannot be used as values:
-
DashboardID
-
QueryID
-
Tokens
-
page
-
start
-
limit
-
-
Open a new browser tab and enter the URL below, replacing the placeholders:
https://((PRESENTATION_SERVER))/#dashboard/Devices in Zone?Zone=((DEVICE_ZONE)) ----- EXAMPLE ----- https://unified-assurance.example.com/#dashboard/Devices in Zone?Zone=3
The dashboard will open and use the value from the URL instead of the default token value.