How to use the Context Selector in a Dashboard?

Document ID : KB000009870
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

This article aims to illustrate how to use Context Selector within a Dashboard so different widgets can take advantage of it.

Background:

I saw some cases were customers were asking how to work with Context Selector but unfortunately the documentation was not very clear. After working with one of my customers on this, I decided to write this article to have a starting point to work with Context Selector.

Environment:
From the last UIM's supported version onward:https://support.nimsoft.com/downloads/doc/Current_-_End_of_Sales_Announcement.pdf
Instructions:

In this example, I will be using two custom fields to provide Time and System to my Context Selector.

By default, a Time field shows up when you add the Context Selector, however, you need to tweak it to get the desired functionality, thus, I created a custom one and called it "Time" to replace the one that comes by default.

With this two Context Selector fields I'll be able to show information that can vary depending on the time and the system(s). In this particular example, I'll be working with CPU Usage (QOS_CPU_USAGE) and Memory Usage (QOS_MEMORY_PHYSICAL_PERC).

This is how my Dashboard looks like in Live View:

Dashboard.png

This is how the Time drop-down lists look like:

Time.png

And this is the configuration of the Time (custom) field:

- As Parameter Name I typed in "time", which is the variable I will then be using to populate my CPU Usage - Historical graph.

- Then, I chose "Manually enter values", to simulate the labels that come in the default Time field.

- I populated the label with the following (hourly values):

Context Time.png

 

This is how the System drop-down lists look like:

System.png

 

And this is the configuration for the System (custom) field:

 

System context.png

 

- I used "system" as the Parameter Name, to be able to later use it as a variable in the query that will populate my CPU Usage - Historical graph.

- The query ("Get values from SQL data source") used for this field is the following one:

select DISTINCT (source), source from S_QOS_DATA;

- The above query is the one that made possible to have my 3 different systems showing up in the System drop-down list.

 

Now, to be able to have the field "System:" displaying the current system in the Dashboard, I've just used this:

System: ${system}

System variable.png

 

Then, for the Memory Usage gauge:

- I found the RN_QOS_DATA table that was responsible for QOS_MEMORY_PHYSICAL_PERC by looking into my S_QOS_DATA table.

- I then passed the gauge the following query:

SELECT TOP 1 D1.samplevalue

FROM S_QOS_DATA AS Q INNER JOIN RN_QOS_DATA_0029 AS D1 ON Q.table_id=D1.table_id

WHERE (Q.SOURCE = '${system}')

ORDER BY Q.sampletime ASC;

- That query allows to bring the QOS_MEMORY_PHYSICAL_PERC (the last value, since the gauge is meant to display just one value) and switch between systems (the WHERE clause making use of the '${system}' variable).

 

Finally, for the historical CPU Usage:

- I found the RN_QOS_DATA table that was responsible for QOS_CPU_USAGE by looking into my S_QOS_DATA table.

- I then passed the graph the following query:

SELECT D1.sampletime, D1.samplevalue

FROM S_QOS_DATA AS Q INNER JOIN RN_QOS_DATA_0014 AS D1 ON Q.table_id=D1.table_id

WHERE (Q.source = Q.target) AND (Q.target = '${system}')

AND (D1.sampletime > DATEADD (hour, -${time}, GETDATE()))

ORDER BY Q.sampletime ASC;

- That query allows to bring the QOS_CPU_USAGE and switch between system and time (by using the system and time variables)

 

Additional Information: