Cloudability Set up Azure Memory Metrics Collection (using Azure Monitor)

Apptio Cloudability leverages performance data sourced from Azure Monitor Metrics to provide insightful and accurate rightsizing recommendations for Azure Compute Virtual Machines. There are two levels of metrics available from Azure Monitor Metrics - Platform and Guest OS metrics.
  • Platform metrics:
    • Key Metrics: CPU Percentage, Disk Reads/Writes, Network Throughput
    • Enabled after you have set up Azure Rightsizing and RI Planning.

    Set up Azure Rightsizing and Reserved Instance Planning

  • Guest OS metrics:
    • Key Metrics: Memory Utilization
    • Requires a Guest OS agent and diagnostic data sync
    • Enabled after completing the steps below

Although Guest OS metrics are not required for Rightsizing Recommendations, they are strongly encouraged. Our analysis has shown that by understanding memory usage, Cloudability  can make even better informed and sized recommendations, typically resulting in 10-20% additional cost savings.

  1. Enable Azure Monitor

    Enable monitoring in Azure.

    Enable Azure Monitor

  2. Enable managed identity

    Enable Azure resources to authenticate to cloud services without storing credentials in code.

    Enable managed identity

  3. Enable diagnostics

    Enable Azure to access diagnostics. There are separate instructions for Windows and Linux.

    Send diagnostic data to Azure Monitor (Windows Only)

    Install Diagnostics Agent (Linux Only)

Enable Azure Monitor
  1. In the Azure portal search, type virtual machines .
  2. Under Services , select Virtual machines .
  3. In the Virtual machines page, select the desired virtual machine.
  4. In the left navigation panel, under Monitoring , select Diagnostic settings .
  5. In the Overview tab, from the Diagnostics storage account drop-down, select or create a diagnostics storage account.
  6. Select Enable guest-level monitoring .
    Note:

    If the Enable guest-level monitoring option is disabled, you must enable managed identity for this resource.

    Enable managed identity

  7. Select Save .

Enable managed identity

A system-assigned managed identity enables Azure resources to authenticate to cloud services without storing credentials in code. For more information, see What are managed identities for Azure resources?

  1. In the Azure portal search, type virtual machines .
  2. Under Services , select Virtual machines .
  3. In the Virtual machines page, select the virtual machine you want.
  4. In the left navigation panel, select Identity .
  5. Under Status , select On .

  6. Select Save .
Send diagnostic data to Azure Monitor (Windows Only)
  1. In the Azure portal search, type virtual machines .
  2. Under Services , select Virtual machines .
  3. In the Virtual machines page, select the virtual machine you want.
  4. In the left navigation panel, select Diagnostic settings .
  5. In the Sinks tab, under Send diagnostic data to Azure Monitor , select Enabled .

  6. Select Save .
Note:

If the Send diagnostic data to Azure Monitor option is disabled, you must enable managed identity for this resource.

Install Diagnostics Agent (Linux Only)

For Linux virtual machines, a diagnostics agent is required. For more information, refer to "Collect custom metrics for a Linux VM with the InfluxData Telegraf agent" https://docs.microsoft.com/en-us/azure/azure-monitor/platform/collect-custom-metrics-linux-telegraf .
  1. Remotely log into the virtual machine via SSH.
  2. Download the Telegraf package.

    wget https://dl.influxdata.com/telegraf/releases/telegraf_1.13.4-1_amd64.deb

  3. Install the package.
    • Ubuntu and Debian

      sudo dpkg --install --force-confnew telegraf_1.13.4-1_amd64.deb

    • RedHat and CentOS

      sudo yum localinstall -y telegraf-1.13.4-1.x86_64.rpm

  4. Generate the new Telegraf configuration file in the current directory.

    telegraf --input-filter cpu:mem --output-filter azure_monitor config > azm-telegraf.conf

  5. Replace the example configuration with the new generated configuration.

    sudo cp azm-telegraf.conf /etc/telegraf/telegraf.conf

  6. Stop the Telegraf agent on the VM.

    sudo systemctl stop telegraf

  7. 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 , select the desired Log Analytics Workspace
  3. In the left navigation panel, under the Workspace Data Source section, select Virtual Machines .
  4. View the grid to verify each resource is associated with a Log Analytics Workspace.

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 , select Metrics .
  3. In the Metrics panel, select the Metric Namespace drop-down.
    • For Windows resources, you should see three metrics:
      • Virtual Machine Host
      • Guest (classic)
      • Virtual Machine Guest - source of memory metrics

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