Microsoft Azure Monitor

Follow the steps below to enable memory metrics in Azure Monitor Metrics for Compute Software.

Enable Azure Monitor Steps

1. In the Azure portal search, type “virtual machines”.

2. Under Services, click Virtual machines.

3. In the Virtual machines page, select the desired virtual machine.

Image Name

4. In the left panel, under Monitoring, click Insights.

5. Click Enable.

Image Name

6. In the Workspace Subscription dropdown, select the subscription you want.

Image Name

7. In the Choose a Log Analytics Workspace dropdown, select or create a log analytics workspace. Click Enable.

8. Alternatively, you can enable this via Azure Policy for Virtual Machines.

Enable Managed Identity Steps

A system-assigned managed identity enables Azure resources to authenticate to cloud services without storing credentials in code.

1. In the Azure portal search, type “virtual machines”.

2. Under Services, click Virtual machines.

3. In the Virtual machines page, select the virtual machine you want.

4. In the left panel, click Identity. Under Status, select On. Click Save.

Image Name

Enable Diagnostic Data Sink Steps

1. In the Azure portal search, type “virtual machines”.

2. Under Services, click Virtual machines.

3. In the Virtual machines page, select the virtual machine you want.

4. In the left panel, under Monitoring, click Diagnostic Settings.

5. In the Overview tab, under the Diagnostics storage account drop-down, select or create a diagnostics storage account.

Image Name

6. Click Enable guest-level monitoring. Click Save.

Send Diagnostic Data to Azure Monitor (Windows Only) Steps

1. In the Azure portal search, type “virtual machines”.

2. Under Services, click Virtual machines.

3. In the Virtual machines page, select the virtual machine you want.

4. In the left panel, click Diagnostic settings.

5. In the Sinks tab, under Send diagnostic data to Azure Monitor, select Enabled. Click Save.

Image Name

Install Diagnostics Agent (Linux Only) Steps

For Linux virtual machines, a diagnostics agent is required. For more information, see Collect custom metrics for a Linux VM with the InfluxData Telegraf agent.

1. Remotely log into the VM (SSH).

2. Copy and run one of the following scripts to download, install, and start the agent.

For Ubuntu and Debian:

  1. download telegraf package wget https://dl.influxdata.com/telegraf/releases/telegraf\_1.13.4-1\_amd64.deb
  2. install the package sudo dpkg --install --force-confnew telegraf_1.13.4-1_amd64.deb
  3. generate the new Telegraf config file in the current directory telegraf --input-filter cpu:mem --output-filter azure_monitor config > azm-telegraf.conf
  4. replace the example config with the new generated config sudo cp azm-telegraf.conf /etc/telegraf/telegraf.conf
  5. stop the telegraf agent on the VM sudo systemctl stop telegraf
  6. start the telegraf agent on the VM to ensure it picks up the latest configuration sudo systemctl start telegraf

For RedHat and CentOS:

  1. download telegraf package wget https://dl.influxdata.com/telegraf/releases/telegraf-1.13.4-1.x86\_64.rpm
  2. install the package sudo yum localinstall -y telegraf-1.13.4-1.x86_64.rpm
  3. generate the new Telegraf config file in the current directory telegraf --input-filter cpu:mem --output-filter azure_monitor config > azm-telegraf.conf
  4. replace the example config with the new generated config sudo cp azm-telegraf.conf /etc/telegraf/telegraf.conf
  5. stop the telegraf agent on the VM sudo systemctl stop telegraf
  6. start the telegraf agent on the VM to ensure it picks up the latest configuration sudo systemctl start telegraf

Troubleshooting

Linked to Log Analytics Workspace

The virtual machine resources need to be connected to a log analytics workspace, to verify this:

1. In the Azure portal search, type “log analytics workspaces”.

2. Under Name, click the desired Log Analytics Workspace

3. Under the Workspace Data Source section, click Virtual Machines In the left panel

4. View the grid to verify each resource is associated with a Log Analytics Workspace.

Image Name

Required Metrics Namespace

Ensure the metrics namespace has been enabled, by following these steps:

1. In the Azure portal search, type “virtual machines”.

2. Under Monitoring, click Metrics

3. In the Metrics panel, click the Metric Namespace dropdown.

  • For Windows resources, you should see three:

- Virtual Machine Host

- Guest (classic)

- Virtual Machine Guest  (source of memory metrics)

Image Name

  • For Linux resources, you should see four:- Virtual Machine Host- Guest (classic)- telegraf/mem (source of memory metrics)- telegraf/cpu

Image Name