This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.
Instead of hard-coding values for fields like resource group or resource name in your queries, you can use variables in their place to create more interactive, dynamic, and reusable dashboards.
Check out the Templating documentation for an introduction to the templating feature and the different types of template variables.
The Azure Monitor data source provides the following queries you can specify in the Query field in the Variable edit view
|Resource Groups||Returns resource groups for a specified subscription.|
|Namespaces||Returns metric namespaces for the specified subscription and resource group.|
|Resource Names||Returns a list of resource names for a specified subscription, resource group and namespace.|
|Metric Names||Returns a list of metric names for a resource.|
|Workspaces||Returns a list of workspaces for the specified subscription.|
|Logs||Use a KQL query to return values.|
Any Log Analytics KQL query that returns a single list of values can also be used in the Query field. For example:
|Returns a list of Virtual Machines|
|Returns a list of Virtual Machines with template variable|
|Returns a list of objects from the Perf table|
|Returns a list of metric names from the Perf table|
Example of a time series query using variables:
Perf | where ObjectName == "$object" and CounterName == "$metric" | where TimeGenerated >= $__timeFrom() and TimeGenerated <= $__timeTo() | where $__contains(Computer, $computer) | summarize avg(CounterValue) by bin(TimeGenerated, $__interval), Computer | order by TimeGenerated asc
Related Grafana resources
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.