Ingest metrics from Azure Monitor

You can use OpenTelemetry Collector to ingest metrics from Azure Monitor. Once metrics are flowing into Cloud Observability, you can use prebuilt dashboards to view them.

Prerequisites

  • A Cloud Observability access token for the project that will ingest metrics.
  • You’ve configured the Collector to export metric data to Cloud Observability.

Register an Azure application and set environment variables

  1. Register an application that will be used by Collector to get metrics.
    • Log into the Azure portal.
    • Click Azure Active Directory and then App registrations to create the application.
    • In the new application, navigate to Certificates & secrets and create a new client secret.
  2. Assign permissions to the app.
    • Navigate back to the portal home page and click Subscriptions.
    • Choose your current subscription and click Access control (IAM).
    • Click Add role assignment, select Monitoring Reader role and add it to the new app.
  3. Set the following Azure credentials as environment variables:
    • AZURE_CLIENT_ID
    • AZURE_CLIENT_SECRET
    • AZURE_SUBSCRIPTION_ID
    • AZURE_TENANT_ID

Configure the Collector receiver

In the OpenTelemetry Collector configuration file, add azuremonitor as a receiver and set the following:

  • subscription_id
  • tenant_id
  • client_id
  • client_secret
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
receivers:
  azuremonitor:
    subscription_id: "${AZURE_SUBSCRIPTION_ID}"
    tenant_id: "${AZURE_TENANT_ID}"
    client_id: "${AZURE_CLIENT_ID}"
    client_secret: "${AZURE_CLIENT_SECRET}"
    resource_groups:
      - "example-resources"
    services:
      - "microsoft.compute/disks"
      - "Microsoft.Network/networkInterfaces"
      - "Microsoft.Compute/virtualMachines"
    collection_interval: 60s

exporters:
  logging:
    loglevel: debug
  otlp/public:
    endpoint: ingest.lightstep.com:443 # US data center
    # endpoint: ingest.eu.lightstep.com:443 # EU data center 
    headers:
        "lightstep-access-token": "${LS_ACCESS_TOKEN}"

processors:
  batch:

service:
  pipelines:
    metrics/azuremonitor:
      receivers: [azuremonitor]
      processors: [batch]
      exporters: [logging, otlp/public]

View optional settings and descriptions.

Enable the Collector receiver

Once the Azure receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Create a prebuilt dashboard

Follow these instructions to create pre-built dashboards for the Azure metrics.

See Azure documentation for a complete list of emitted metrics.

Additional resources

For a more complete example that’s ready to run, see the Azure integrations in Cloud Observability OpenTelemetry Examples.

See also

Ingest metrics using the Collector

Create and manage dashboards

Updated Sep 5, 2023