Introduction to UI Queries in Foglight

Think of a UI Query as a shortcut to data that you can use in a report, dashboard, service definition, etc. This post will show how to get started building queries. 

The example today will be to get a list of all SQL Server Agent Jobs, regardless of the instance they reside on.

In Expert mode, navigate to the Configuration -> Definitions dashboard. Create a WCF module to store the queries in, or select an existing one. Select Queries from the dropdown and then click the (+) button.

The query has to return a data type, and since we are looking for SQL Server Agent Jobs, type "job" in the search box.

There are only 5 required fields to build this UI Query. Provide a name then check the boxes for Public and UI Query.

The Root Reference "From" will almost always be Monitoring.

The "Path" tells Foglight where in the data model to find the data that satisfies the Object Type (DBSS_Agent_Job_List) in this case. 

To check if the path is correct, click the Test button. This will also be the result of the query. Clicking "Close" then "Save" will create your query and it's ready to use. But there are a couple more settings to cover for completeness.

Filters can be added to only return "only the top N" or "Everything except the top N" values. A where clause can be added to filter the list. My person preference is to have the query return everything (no filter) and perform the filtering in the UI (eg. in Service Builder to build a service, or in a dashboard where you can have similar filter options.)

Here is a screen capture of the steps in real time. It doesn't take that long once you get the hang of it!

For additional information on Foglight, click over here.

Anonymous