# Variable, Save Querying and View

### Variable

**Variable** allows you to dynamically display tracking information on a dashboard. With a single dashboard, you can select a value for the variable to view information on various objects.

To create a variable in a dashboard, follow the instructions below:

1. Access the Dashboard where you want to create a Variable, and select **Create a variable**
2. Select **Add a variable**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-ad31eee6beb5362560b04d77cdfc4332917bd90e%2Fimage%20(81).png?alt=media" alt=""><figcaption></figcaption></figure>

3\. Select/enter the following information:

* **Dimension Key**: choose a dimension key that will provide a list of values for your variable, for example, hostname.
* **Name**: name the variable, the system will automatically generate a suitable name based on the selected dimension key
* **Filter**: you can filter the values of this variable with other dimension keys or variables
* **Default value**: default value for the variable
* **Values**: list of values for the variable, taken from the selected dimension key.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-4619f22e703493aecea15026df0a5701b266e291%2Fimage%20(82).png?alt=media" alt=""><figcaption></figcaption></figure>

Suppose here we choose the dimension key as **hostname.** You will see the values of the variable will be a list of all hosts in the system. Here you can select **Dynamic by time range** for the system to automatically include all hostnames based on the selected time range, or you can choose specific hostnames from the displayed list. For optimal performance, we recommend using **Dynamic by time range.**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-0c36705aad5143d473b60aeaee60dc47d2619e4c%2Fimage%20(83).png?alt=media" alt=""><figcaption></figcaption></figure>

4\. To apply this variable to widgets, you can manually add/edit the widget and include it in the filter section, or use the auto-add feature here. When you click +, the system will automatically add this variable to all widgets in the dashboard. Similarly, clicking - will automatically remove it.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-8cb133e249f342f8f0076c414e7f189a2a12e2e6%2Fimage%20(84).png?alt=media" alt=""><figcaption></figcaption></figure>

5\. Select "**Save**" to create a variable

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-af92c221f694cabcb10a11241c70df08542cc64d%2Fimage%20(85).png?alt=media" alt=""><figcaption></figcaption></figure>

You will notice that using the auto-add feature ( + ), the widgets on the dashboard will automatically add $hostname to the filter. However, when using this feature, you should also review the list of selected dimensions to ensure they are appropriate and make adjustments accordingly.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-22378a1a700586c4b1d97a5b2bba45d3855a47c4%2Fimage%20(86).png?alt=media" alt=""><figcaption></figcaption></figure>

If you do not use the auto-add feature, you can manually add to the filter as usual, and the system will display the variable as a dimension key.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-a2a8584203b043df298dd30e241fb1b3df5871f4%2Fimage%20(87).png?alt=media" alt=""><figcaption></figcaption></figure>

When the variable is successfully created, you will see it displayed on the dashboard and can select a value to display the dashboard according to the selected value.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-ee3f1e4156c09624b05c0a0deb02fd3bf219ad35%2Fimage%20(88).png?alt=media" alt=""><figcaption></figcaption></figure>

From here, you can choose different hosts to monitor parameters very flexibly without needing to create or view multiple dashboards.

***

### View

**View** allows you to create perspectives for the dashboard, saving variable values for later use.

To create a **View** for a dashboard, follow the instructions below:

1. After you have a variable and want to save its value for convenient access later, use the **View** feature and click "**Save view**" to save it.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-10b268980192594dc8e3487dd89eed9fefc45df8%2Fimage%20(89).png?alt=media" alt=""><figcaption></figcaption></figure>

2\. Name the view, and when you select this view, the system will automatically populate the list of variables below.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-ce26cf66e77b2d0bc19bae2105af661469b8200d%2Fimage%20(90).png?alt=media" alt=""><figcaption></figcaption></figure>

3\. After successfully creating views, you will see a list of views to choose from. Suppose there are two views: host-storagegw and host-nginx

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-35bd8d3749cdc0821ba36fe869b851d200e70b79%2Fimage%20(91).png?alt=media" alt=""><figcaption></figcaption></figure>

4\. When you select view: host-nginx, the system will automatically load a list and different values for the variable.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-4528a07592a66e429b0c1d8a780920ac2de384e8%2Fimage%20(92).png?alt=media" alt=""><figcaption></figcaption></figure>

5. To manage Views and Variables, you can click on the gear icon:

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-6464d8cccc25431edc75a9d0b200a7b953651d47%2Fimage%20(93).png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Save query

vMonitor Platform provides you the ability to reuse a query that you have previously created through the Save query feature that we offer.

#### Save query

To save a query, follow the instructions below:

1. In the query command area, click the **Save** icon.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-c04b978cb04cd9f8113f3bc1e006776fbdce2f71%2Fimage%20(94).png?alt=media" alt=""><figcaption></figcaption></figure>

2. Enter the **Query name**.
3. Select **Save**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-1810f9a2e883bf31dce59017bfcc5fa0581802d4%2Fimage%20(95).png?alt=media" alt="" width="342"><figcaption></figcaption></figure>

The query is now saved with the memorable name you entered.

### Reuse existing queries

After you have saved the query, you can reuse this query by:

1. In the query command area, select the dropdown icon <img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-85e7ceeb8157c91182195bdcefcb0d2e12d7b309%2Fimage.png?alt=media" alt="" data-size="original"> (this icon is located next to the Save query icon).

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-03e0e33436e39d25890b315428cf34f6550b970d%2Fimage%20(96).png?alt=media" alt=""><figcaption></figcaption></figure>

2. At this point, the system displays a list of saved queries, allowing you to reuse them by selecting the desired query.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-8e668e78d50d79994edd92571f321bee5c3b8880%2Fimage%20(97).png?alt=media" alt=""><figcaption></figcaption></figure>

3. You can edit this query and save it as a new independent query from the one you reused by selecting Save as new query.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-7aa3f00b8da1ac243f00b2e3a7ab869c109c5dea%2Fimage%20(98).png?alt=media" alt=""><figcaption></figcaption></figure>

### Query management

You can view the saved queries or delete a query by selecting Manage saved queries and choosing the **Delete** icon.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-bb04b877ce9d2caed628bf88396035829359c531%2Fimage%20(99).png?alt=media" alt=""><figcaption></figcaption></figure>
