Variables
A variable is a placeholder for a value. You can use variables in queries, in panel titles, and when defining new dashboards. So when you change the value, using the dropdown, your panel’s metric queries will change to reflect the new value.
The following variables are available:
- Target Type
Fetches the list of all the target types.
Note:
If you are using a version of EM App for Grafana prior to v4.0.0, you need to specify the variable as a JSON string.
- Target Name
Fetches the list of all the target names, given a specific target type.
Note:
If you are using a version of EM App for Grafana prior to v4.0.0, you need to specify the variable as a JSON string.
- Named Credential
Fetches the list of available EM named credentials defined for a given target, identified by the target type and target name.
Note:
If you are using a version of EM App for Grafana prior to v4.0.0, you need to specify the variable as a JSON string.
- Repository Query Variable
Starting with EM App for Grafana v4.0.0, the Repository Query variable is available, which is executed against the repository database. The values for this variable can later be referenced in other rawQuery's in the Query editors. If the specified SQL query only returns one column, it's used as both the
label
and value for the variable. If the specified SQL query returns 2 or more columns, the first column is used as the label, and the second column is used as the value. The label is displayed in the variable drop down for user to select,while the value is the string substituted when the variable is used. - Time Difference
Starting with EM App for Grafana v4.0.0, the Time Difference variable is available, which can be defined to calculate the time difference between the specified From and To values in the specified unit of time. The values of the From and To properties can be other template variables or the Grafana built-in variable ${__from} and ${__to}. These built-in variables represent the time range chosen by the user in the time picker.
- Time Picker
Starting with EM App for Grafana v4.0.0, the Time Picker variable is available, which can be defined to modify the time picker automatically, without explicitly choosing it from the UI. The controls for this variable can either be a FromTo or an Interval and Unit. The values for both FromTo and Interval must come from other template variables because if the values are known constants at the time of variable defining, using this variable would be redundant. FromTo must resolve to a value in the form of <from>;<to>or <from>; where <from> and <to> are widely recognized datetime strings (e.g. ISO 8601, RFC 2822, unix timestamps) or relative Grafana strings (e.g. now-6d, now-6h). When the value resolves to a value of the form <from>, it is equivalent to <from>;now.
Here are some examples of acceptable value formats:
now-6d;now, now-6d, 1669158747;1669168747, 1669158747, 2022-01-01;2022-01-31, 2022-01-01