Add a query variable | Grafana Labs
grafana.com › variable-types › add-query-variableQuery variables allow you to write a data source query that can return a list of metric names, tag values, or keys. For example, a query variable might return a list of server names, sensor IDs, or data centers. The variable values change as they dynamically fetch options with a data source query. Query variables are generally only supported for strings.
Variable examples | Grafana Labs
grafana.com › latest › variablesThis page contains links to dashboards in Grafana Play with examples of template variables. Elasticsearch Metrics - Uses ad hoc filters, global variables, and a custom variable. Graphite Templated Nested - Uses query variables, chained query variables, an interval variable, and a repeated panel. Influx DB Group By Variable - Query variable, panel uses the variable results to group the metric data.
Queries | Grafana Labs
https://grafana.com/docs/grafana/latest/panels/queriesGrafana automatically calculates an appropriate interval and it can be used as a variable in templated queries. The variable is either in seconds: $__interval or in milliseconds: $__interval_ms. It is typically used in aggregation functions like sum or average. For example, a Prometheus query using the interval variable: rate (http_requests ...
Queries | Grafana Labs
grafana.com › docs › grafanaHere are two query examples: PostgreSQL. SELECT hostname FROM host WHERE region IN($region) PromQL. query_result(max_over_time(<metric>[${__range_s}s]) != <state>) For more information about writing a query for your data source, refer to the specific Grafana data source documentation. Query tab UI. The Query tab consists of the following elements: