Microsoft Azure VM - Enabling Azure Monitor Agent for Windows & Linux VMs

Microsoft Azure VM - Enabling Azure Monitor Agent for Windows & Linux VMs

Purpose of Diagnostics Agent and Azure Monitor Agent


            Additional metrics from Azure Virtual Machine can be fetched via Diagnostic Extensions (DE) or Azure Monitor Agent (AMA). In Diagnostic Extensions, data is pushed to Azure Storage Account to which Applications Manager connects for fetching data. In Azure monitor agent, data is pushed to Azure Monitor (native Azure monitoring service) by configuring Data Collection Rule, whereas storing data in Storage Accounts (legacy approach) is avoided.
Why Azure Monitor Agent?
  1. Diagnostic Extensions requires firewall access and may require to enable private endpoint to fetch the metrics from storage accounts and may encounter issues in retrieving data & managing the associated storage costs.
  2. Until Applications Manager v171300 we relied on Diagnostics Extensions (DE), but starting from Applications Manager v171400 we also support Azure Monitor Agent (AMA)  to overcome these limitations.
    1. Refer to this document to know about the agent supported for different server distributions.

Summary of Azure Monitor Agent Configuration

    1. In Azure Portal, create Data Collection Rule 
      1. Select Platform Type based on the OS type.
      2. Add respective VM under the Resources.
      3. Select the metrics listed in the below Windows Metrics Mapper Table or Linux Metrics Mapper Table as Data Source based on the OS type.
      4. Deploy the Data Collection Rule and ensure the Agent is installed.
    2. In Applications Managerselect Azure Monitor Agent as the Agent Type in the Edit Monitor Page.

    Detailed Steps to enable Azure Monitor Agent in Azure Portal

    1. Log in to Azure Portal (https://portal.azure.com).
    2. Navigate to 'Data collection rules' using search bar and create a new resource under it for agent installation.
    3. Create a new Data Collection Rule
      1. In Basics tab, Select Platform Type as 'Windows' or 'Linux' or 'All' based on the respective virtual machine OS type.
      2. In Resources tab, click on 'Add resources' and select the respective Virtual machines.
      3. In Collect and deliver tab, click on 'Add data source' and select the Data source type as Performance Counters.
        1. Under Performance Counters, all the listed categories of Basic are chosen by defaultand the metrics monitored in Applications Manager are included in it. If the user wants to enable agent only for APM monitored metrics, switch to Custom and select the metrics listed in the below table Windows Metrics Mapper Table or Linux Metrics Mapper Table based on the OS type.
        1. In Destination, click 'Add destination' and Specify destination type as Azure Monitor Metrics (preview). After that, click on 'Add data source'.
        2. Proceed to click on 'Review + create' and review the configurations & click 'Create' to deploy the resource for agent installation.
    4. Confirm the status of the installed agent is Provisioning succeeded.
      1. Navigate to the respective virtual machine and ensure the virtual machine is in Running state. Then select Extensions + applications under 'Settings' in the Left Panel.
      2. Ensure the status is 'Provisioning succeeded' for AzureMonitorWindowsAgent (or) AzureMonitorLinuxAgent based on OS type of the VM.
      3. If agent status is not in succeeded state, please check the troubleshooting steps.
    5. Ensure the metrics are added under Azure Monitor Metrics.
      1. In the respective virtual machine, select Metrics under Monitoring in the Left Panel.
      2. Click on 'Add metric' and select 'Metric Namespace' as  Virtual Machine Guest for Windows (or) azure.vm.linux.guestmetrics for Linux.
      3. Verify whether all the Applications Manager supported metrics are listed under 'Metric' list.

    Windows Metrics Mapper Table

    Metric Name in Azure Portal
    Metric Name in Applications Manager
    \Processor Information(_Total)\% Privileged Time
    Privileged Time
    \Processor Information(_Total)\% User Time
    User Time
    \Processor Information(_Total)\Processor Frequency
    Processor Frequency
    \Memory\Committed Bytes
    Committed Bytes
    \Memory\Available Bytes
    Available Bytes
    \Memory\% Committed Bytes In Use
    Committed Bytes In Use
    \Memory\Pool Paged Bytes
    Pool Paged Bytes
    \Memory\Pool Nonpaged Bytes
    Pool Nonpaged Bytes
    \Memory\Page Faults/sec
    Page Faults/sec
    \Process(_Total)\Thread Count
    Thread Count
    \System\Context Switches/sec
    Context switches/sec
    \System\Processes
    Process Count
    \Process(_Total)\Handle Count
    Handle count

    Linux Metrics Mapper Table

    Metric Name in Data Collection Rule
    Metric Name in Azure Monitor Metrics
    Metric Name in Applications Manager
    Processor(*)\% IO Wait Time
    cpu/usage_iowait
    IO Wait Time (%)
    Processor(*)\% Idle Time
    cpu/usage_idle
    Idle Time (%)
    Processor(*)\% Processor Time
    cpu/usage_active
    Processor Time(Linux) (%)
    Memory(*)\% Used Memory
    mem/used_percent
    Memory Utilization
    Memory(*)\Available MBytes Memory
    mem/available
    Available Memory
    Memory(*)\Used Memory MBytes
    mem/used
    Used Memory
    Memory(*)\% Available Memory
    mem/available_percent
    Available Memory %
    Memory(*)\% Used Swap Space
    swap/used_percent
    Used Swap Memory %
    To know about the list of metrics supported for Azure Virtual Monitor under all methods please refer this help document.
    Memory Utilization metric in Azure Linux Virtual Machine monitors is supported only for 'Azure monitor agent' agent type from Applications Manager v171900.
    Enabling Azure Monitor Agent in Applications Manager
    1. Navigate to the respective virtual machine monitor in Applications Manager and click on edit monitor page. Ensure the Agent Type is selected as Azure monitor agent.
    2. By default Agent Type will be opted as 'Azure monitor agent' and for existing monitors before the v171400 Agent Type will be Diagnostic agent.
    For Azure Government Cloud VM monitors, 'Azure monitor agent' agent type is not supported and by default 'Diagnostic agent' will be selected.

    Troubleshoot: AM Agent not in Provisioning succeeded state

    1. Ensure Python 2 is installed in respective virtual machine. Refer to documentation for Python installation procedures.
    2. In the respective virtual machine, under Extensions + Applications, if the Status of AzureMonitorWindowsAgent or AzureMonitorLinuxAgent is not 'Provisioning succeeded', click on the agent and review the Status message . Take necessary actions as indicated in the message. Example: Installing required packages to ensure proper configuration. Refer documentation to know the requirements for Agent installation.


    Other Relevant Information

    1. Diagnostic Extension is now considered a legacy approach and it is limited to some server distributions. It is recommended to switch to Azure Monitor Agent (AMA).
    2. In Applications Manager to fetch agent metrics for Azure Virtual Machine monitor using 'Diagnostics agent', Contributor role is required. Whereas for 'Azure monitor agent' Reader role is sufficient to fetch data.
    3. From Applications Manager v171400,  Azure monitor agent is supported. Refer help documentation to know more.


                    New to ADSelfService Plus?