SolarWinds template variables
Use template variables to create dynamic, reusable dashboards. Instead of hard-coding values such as node names or volumes into your queries, you can use variables that update from a drop-down at the top of the dashboard.
Before you begin
Supported variable types
The SolarWinds data source supports the following variable types:
Create a query variable
The SolarWinds variable editor uses the same SWQL query editor as a dashboard panel. After you write a query, you select which result field provides the variable values and, optionally, which field provides the display labels.
To create a query variable that gets its values from SolarWinds:
- Navigate to Dashboard settings > Variables.
- Click Add variable.
- Select Query as the variable type.
- Select the SolarWinds data source.
- Enter your SWQL query in the SWQL Query field.
- Set Value Field to the result column whose values you want to use for the variable.
- Optionally, set Label Field to a result column to show friendlier labels in the drop-down. If you leave it empty, the value is also used as the label.
- Confirm the preview shows the expected values, then save the variable.
Query examples
The following SWQL queries return values you can use in a variable.
List node names
This query returns the caption of each node:
SELECT DISTINCT Caption FROM Orion.Nodes ORDER BY CaptionSet Value Field to Caption.
List volumes
This query returns the caption of each volume:
SELECT Caption FROM Orion.Volumes ORDER BY CaptionSet Value Field to Caption.
Use separate value and label fields
This query returns the node ID and the node caption, so you can store the ID as the variable value while showing the name in the drop-down:
SELECT NodeID, Caption FROM Orion.Nodes ORDER BY CaptionSet Value Field to NodeID and Label Field to Caption. Queries that reference the variable use the node ID, while the drop-down shows the node name.
Use variables in queries
After you create a variable, reference it in a SWQL query with the $variable or ${variable} syntax. For more information, refer to
Variable syntax.
For example, if you have a variable named node, you can filter a query by the selected node:
SELECT Caption, CPULoad FROM Orion.Nodes WHERE Caption = '$node'

