Menu
Grafana Cloud

Azure Metrics integration for Grafana Cloud

Azure is Microsoft’s cloud computing services offering.

Alongside with their compute offering, Azure provides services such as databases, with it’s well known Cosmos DB, storage with Blob Storage, serverless compute with Azure Functions, identity with Azure Active Directory and many others.

The Azure Metrics integration enabled you to send metrics from your Azure projects to Grafana Cloud.

This integration includes 1 pre-built dashboard to help monitor and visualize Azure Metrics metrics.

Grafana Alloy configuration

Before you begin

Grafana Alloy uses an embedded version of the azure-metrics-exporter to collect metrics from Azure Monitor, into Grafana Cloud. Also, Azure Resource Graph is used to identify the resources for gathering metrics.

The exporter uses underneath the Azure SDK. To see how to configure authentication in the environment where the agent will run, please refer to authenticate with Azure.

The Azure credentials used by Grafana Alloy needs:

Install Azure Metrics integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Azure Metrics and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Azure Metrics metrics to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboard to your Grafana Cloud instance, and you can start monitoring your Azure Metrics setup.

Configuration snippets for Grafana Alloy

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Azure Metrics instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced integrations snippets

river
prometheus.exporter.azure "integrations_azure_exporter" {
	subscriptions = ["<subscription_id>"]
	resource_type = "<resource_type>"
	metrics       = ["<metrics>"]
}

discovery.relabel "integrations_azure_exporter" {
	targets = prometheus.exporter.azure.integrations_azure_exporter.targets

	rule {
		target_label = "job"
		replacement  = "integrations/azure_exporter"
	}
}

prometheus.scrape "integrations_azure_exporter" {
	targets    = discovery.relabel.integrations_azure_exporter.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/azure_exporter"
}

This integrations uses the prometheus.exporter.azure component to generate metrics from a Azure Metrics instance.

For the full array of configuration options, refer to the prometheus.exporter.azure component reference documentation.

Here’s the possible configuration values:

  • subscriptions: Required. The azure subscription(s) to scrape metrics from.
  • resource_type: Required. The Azure Resource Type to scrape metrics for. Valid values can be found as the heading on Supported Metrics with Azure Monitor. E.g.: Microsoft.Cache/redis or microsoft.containerservice/managedclusters.
  • metrics: Required. The metrics to scrape from resources. Valid values can be found in the Metric column for the resource_type on Supported Metrics with Azure Monitor. E.g.: node_cpu_usage_millicores for the microsoft.containerservice/managedclusters resource type.
  • included_dimensions: Optional. Used to include Dimensions available to a Metric definition on Supported Metrics with Azure Monitor. E.g.: node and nodepool in the node_cpu_usage_millicores metric, for the microsoft.containerservice/managedclusters resource type. Note that if you pick a set of dimensions, all metrics in the scrape config should also posses that same set of dimensions.
  • included_resource_tags: Optional. A list of resource tags to include on the final metrics. E.g.: node.

If you need to scrape multiple Azure services, or metrics with different dimension sets, create one exporter for each.

This exporter must be linked with a discovery.relabel component to apply the necessary relabelings.

You can then scrape them by including each discovery.relabel under targets within the prometheus.scrape component.

Grafana Agent configuration

Before you begin

Grafana Agent uses an embedded version of the azure-metrics-exporter to collect metrics from Azure Monitor, into Grafana Cloud. Also, Azure Resource Graph is used to identify the resources for gathering metrics.

The exporter uses underneath the Azure SDK. To see how to configure authentication in the environment where the agent will run, please refer to authenticate with Azure.

The Azure credentials used by Grafana Agent needs:

Install Azure Metrics integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Azure Metrics and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Azure Metrics metrics to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboard to your Grafana Cloud instance, and you can start monitoring your Azure Metrics setup.

Post-install configuration for the Azure Metrics integration

This integration is configured to work with the azure-metrics-exporter, which is embedded in the Grafana Agent.

Enable the integration by adding the code snippet in the section above to your agent configuration file.

Here’s the possible configuration values:

  • subscriptions: Required. The azure subscription(s) to scrape metrics from.
  • resource_type: Required. The Azure Resource Type to scrape metrics for. Valid values can be found as the heading on Supported Metrics with Azure Monitor. E.g.: Microsoft.Cache/redis or microsoft.containerservice/managedclusters.
  • metrics: Required. The metrics to scrape from resources. Valid values can be found in the Metric column for the resource_type on Supported Metrics with Azure Monitor. E.g.: node_cpu_usage_millicores for the microsoft.containerservice/managedclusters resource type.
  • included_dimensions: Optional. Used to include Dimensions available to a Metric definition on Supported Metrics with Azure Monitor. E.g.: node and nodepool in the node_cpu_usage_millicores metric, for the microsoft.containerservice/managedclusters resource type. Note that if you pick a set of dimensions, all metrics in the scrape config should also posses that same set of dimensions.
  • included_resource_tags: Optional. A list of resource tags to include on the final metrics. E.g.: node.

For a full description of configuration options see how to configure the azure_exporter_config block in the Agent documentation. If you need to scrape multiple Azure services, or metrics with different dimension sets, see how to scrape multiple azure services in a single configuration.

Configuration snippets for Grafana Agent

Below integrations, insert the following lines and change the URLs according to your environment:

yaml
  azure_exporter:
    enabled: true
    scrape_interval: 60s
    subscriptions:
      - <subscription_id>
    resource_type: <resource_type>
    metrics:
      - <metrics>

Full example configuration for Grafana Agent

Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the Azure Metrics integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.

yaml
integrations:
  prometheus_remote_write:
  - basic_auth:
      password: <your_prom_pass>
      username: <your_prom_user>
    url: <your_prom_url>
  agent:
    enabled: true
    relabel_configs:
    - action: replace
      source_labels:
      - agent_hostname
      target_label: instance
    - action: replace
      target_label: job
      replacement: "integrations/agent-check"
    metric_relabel_configs:
    - action: keep
      regex: (prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
      source_labels:
      - __name__
  # Add here any snippet that belongs to the `integrations` section.
  # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
  azure_exporter:
    enabled: true
    scrape_interval: 60s
    subscriptions:
      - <subscription_id>
    resource_type: <resource_type>
    metrics:
      - <metrics>
logs:
  configs:
  - clients:
    - basic_auth:
        password: <your_loki_pass>
        username: <your_loki_user>
      url: <your_loki_url>
    name: integrations
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      # Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
metrics:
  configs:
  - name: integrations
    remote_write:
    - basic_auth:
        password: <your_prom_pass>
        username: <your_prom_user>
      url: <your_prom_url>
    scrape_configs:
      # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
  global:
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal

Dashboards

The Azure Metrics integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • Azure Metrics Overview

Changelog

md
# 0.0.1 - March 2023

* Initial release

Cost

By connecting your Azure Metrics instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.