Редактиране

Споделяне чрез


How to use the Windows operating system (OS) Azure Monitor Agent Troubleshooter

The Azure Monitor Agent (AMA) Troubleshooter is designed to help identify issues with the agent and perform general health assessments. It can perform various checks to ensure that the agent is properly installed and connected, and can also gather AMA-related logs from the machine being diagnosed.

Note

The Windows AMA Troubleshooter is a command line executable that is shipped with the agent for all versions newer than 1.12.0.0.

Prerequisites

Troubleshooter existence check

Check for the existence of the AMA Agent Troubleshooter directory on the machine to be diagnosed to confirm the installation of the agent troubleshooter:

To verify the Agent Troubleshooter is present, copy the following command and run in PowerShell as administrator:

Test-Path -Path "C:/Packages/Plugins/Microsoft.Azure.Monitor.AzureMonitorWindowsAgent"

If the directory exists, the Test-Path cmdlet returns True.

Screenshot of the PowerShell window, which shows the result of Test-Path PowerShell cmdlet.

If directory doesn't exist or the installation is failed, follow Basic troubleshooting steps.

Yes, the directory exists. Proceed to Run the Troubleshooter.

Run the Troubleshooter

On the machine to be diagnosed, run the Agent Troubleshooter.

To start the Agent Troubleshooter, copy the following command and run in PowerShell as administrator:

$currentVersion = ((Get-ChildItem -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState\" `
    | where Name -like "*AzureMonitorWindowsAgent*" `
    | ForEach-Object {$_ | Get-ItemProperty} `
    | where InstallState -eq "Enabled").PSChildName -split('_'))[1]

$troubleshooterPath = "C:\Packages\Plugins\Microsoft.Azure.Monitor.AzureMonitorWindowsAgent\$currentVersion\Troubleshooter"
Set-Location -Path $troubleshooterPath
Start-Process -FilePath $troubleshooterPath\AgentTroubleshooter.exe -ArgumentList "--ama"
Invoke-Item $troubleshooterPath

It runs a series of activities that could take up to 15 minutes to complete. Be patient until the process completes.

Screenshot of the PowerShell window, which shows the result of the AgentTroubleshooter.

Log file is created in the directory where the AgentTroubleshooter.exe is located.

Example for extension-based install: Screenshot of the Windows explorer window, which shows the output of the AgentTroubleshooter for extension-based install.

Example for standalone install: Screenshot of the Windows explorer window, which shows the output of the AgentTroubleshooter for standalone install.

Frequently Asked Questions

Can I copy the Troubleshooter from a newer agent to an older agent and run it on the older agent to diagnose issues with the older agent?

It isn't possible to use the Troubleshooter to diagnose an older version of the agent by copying it. You must have an up-to-date version of the agent for the Troubleshooter to work properly.

Next Steps