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 VM Scale Sets and forward them to Logz.io.

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 Logz.io public certificate to your Metricbeat server

For HTTPS shipping, download the Logz.io public certificate to your certificate authority folder. You’ll need to run this command on the server that hosts Metricbeat:

sudo curl https://raw.githubusercontent.com/logzio/public-certificates/master/AAACertificateServices.crt --create-dirs -o /etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt
(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 Logz.io configuration

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

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

metricbeat.modules:
- module: azure
  metricsets:
  - 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
  resources:
  # 👇 Duplicate this code block for each resource type whose metrics you want to ship.
  - resource_query: "resourceType eq 'Microsoft.Compute/virtualMachineScaleSets'"
    metrics:
    - name: ["*"]
      namespace: "Microsoft.Compute/virtualMachineScaleSets"

fields:
  logzio_codec: json
  token: <<SHIPPING-TOKEN>>
fields_under_root: true
ignore_older: 3hr
type: metrics
output.logstash:
  hosts: ["<<LISTENER-HOST>>:5015"]
  ssl.certificate_authorities: ['/etc/pki/tls/certs/COMODORSADomainValidationSecureServerCA.crt']
Parameters
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 Replace <<SHIPPING-TOKEN>> with a token for the Metrics account you want to ship to.
Here’s how to look up your Metrics token.
output.logstash.hosts Replace <<LISTENER-HOST>> with your region’s listener host (for example, listener.logz.io). For more information on finding your account’s region, see Account region.
Start Metricbeat

Start or restart Metricbeat for the changes to take effect.

Open your Azure VM Scale Sets monitor dashboard in Logz.io

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

Your metrics should appear in the preconfigured dashboard in your Metrics account. To open it, click > Manage in the left menu, then click Logz.io Dashboards > Azure VM Scale Sets monitor.