To monitor your Azure service metrics, we recommend configuring your services to send their metrics to Azure Monitor. When you set up Metricbeat using the configuration on this page, Metricbeat will collect metrics from Azure Container Groups and forward them to

Metricbeat setup

Before you begin, you’ll need:

Log in to Azure with the CLI

Run this command in the command line:

az login

To complete the process, sign in through your browser.

Get your subscription details

Run this command:

az account show | grep '"id"\\|"tenantId"'

The response shows the subscription ID (the id field) and tenant ID (the tenantId field). You’ll need this information later on, so paste it in your text editor.

Sample response
"id": "d94b1fba-0289-557e-b063-0b6bfc1bdca0",
"tenantId": "9ae0715a-0689-56e8-bb88-2b22f1fa7299",
Create a new Azure AD application

The Metricbeat configuration needs to include credentials for an AD application with reader permissions.

If you don’t already have an AD application with reader permissions, run this command to create one. Replace <<SUBSCRIPTION-ID>> with the id value from step 2:

az ad sp create-for-rbac --role reader \\
--scopes /subscriptions/<<SUBSCRIPTION-ID>> \\
-n logzio-metricbeat \\
| grep '"appId"\\|"password"'

The response shows the client ID (the appId field) and client secret (the password field). You’ll need this information later on, so paste it in your text editor.

Sample response
"appId": "3dcdf53e-f93f-5902-8df2-235c8635aa4d",
"password": "e6ab6d24-4907-5d11-a132-a171ef55355d",
Download the public certificate to your Metricbeat server

For HTTPS shipping, download the public certificate to your certificate authority folder.

sudo curl --create-dirs -o /etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt

You’ll need to run this command on the server that hosts Metricbeat.

(Optional) Disable the system module

By default, Metricbeat ships system metrics from its host. Disable this module so you don’t unintentionally send host metrics:

sudo metricbeat modules disable system
Add configuration

Now you’ll set up the Metricbeat to collect metrics from Azure ContainerGroups.

You’ll need to replace the values surrounded by angle brackets << >> using the parameters below the code block. 👇

- module: azure
  - monitor
  enabled: true
  period: 300s
  client_id: '${AZURE_CLIENT_ID:"<<CLIENT-ID>>"}' # `appId` from step 3
  client_secret: '${AZURE_CLIENT_SECRET:"<<CLIENT-SECRET>>"}' # `password` from step 3
  tenant_id: '${AZURE_TENANT_ID:"<<TENANT-ID>>"}' # `tenantId` from step 2
  subscription_id: '${AZURE_SUBSCRIPTION_ID:"<<SUBSCRIPTION-ID>>"}' # `id` from step 2
  refresh_list_interval: 600s
  # 👇 Duplicate this code block for each resource type whose metrics you want to ship.
    - resource_query: "resourceType eq 'Microsoft.ContainerInstance/containerGroups'"
      - name: ["CpuUsage","MemoryUsage"]
        namespace: "Microsoft.ContainerInstance/containerGroups"
        - name: "containerName"
          value: "*"
      - name: ["NetworkBytesReceivedPerSecond","NetworkBytesTransmittedPerSecond"]
        namespace: "Microsoft.ContainerInstance/containerGroups"

  logzio_codec: json
fields_under_root: true
ignore_older: 3hr
type: metrics
  hosts: ["<<LISTENER-HOST>>:5015"]
  ssl.certificate_authorities: ['/etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt']
Parameter Description
client_id Azure client ID. Replace <<CLIENT-ID>> with the appId value from step 3.
client_secret Azure client secret. Replace <<CLIENT-SECRET>> with the password value from step 3.
tenant_id Azure tenant ID. Replace <<TENANT-ID>> with tenantId from step 2.
subscription_id Azure subscription ID. Replace <<SUBSCRIPTION-ID>> with id from step 2.
resources and namespace Replace <<RESOURCE-TYPE>> with the Azure services you want to monitor. You can find these values in the Resource type column in Metrics and Dimensions Supported from Microsoft.
fields.token Your Metrics account token. Replace <<METRICS-SHIPPING-TOKEN>> with a token for the Metrics account you want to ship to.
Look up your Metrics token.
output.logstash.hosts Your listener host. Replace <<LISTENER-HOST>> with the host for your region. For example, if your account is hosted on AWS US East, or if hosted on Azure West Europe.
Start Metricbeat

Start or restart Metricbeat for the changes to take effect.

Open your Azure Container Instances monitor dashboard in

Give your metrics a few minutes to get from your system to ours, and then open

Your metrics should appear in the preconfigured dashboard in your Metrics account. To open it, search your Metrics dashboards for Azure Container Instances monitor.