Use AGDiag to diagnose availability group health events

Note

To diagnose Always On availability group health issues that trigger availability group failover, see Troubleshoot Always On Availability Groups failover.

AGDiag is an application that automates the manual analysis described in the article (mentioned in the Note section). It analyzes the cluster log and correlates and reports pertinent events from the other logs (SQL Server error logs, Windows event logs, and so on). It generates a summary report of Windows Cluster and Always On health events and then provides more detailed analysis results for each health event detected. It automates much of the work described in the article (mentioned in the Note section) when the proper logs are provided from the availability group primary replica at the time of the health event.

Use TSS to generate logs for AGDiag to diagnose

To diagnose an availability group health event, use the TSS to collect logs on the SQL Server instance that was in the primary role at the time of the event.

Follow these steps to accomplish this goal:

  1. Download the toolset (TSSv2.zip) as a zip file. For more information, see Introduction to TroubleShootingScript toolset (TSSv2).

  2. Save and extract the zip file to a folder on the SQL Server instance that hosted the availability group primary replica when the failover started or the availability group was resolving.

  3. Open an elevated command prompt, change the directory to the TSS folder where the zip file TSSv2.zip was saved and extracted, run TSS SDP:SQLBase, and respond to the prompts.

    Screenshot of the elevated command prompt changing the directory to the TSS folder.

  4. Once the TSS SQLBase cab file has been created, extract the cab file into a folder.

    Screenshot of extracting the SQLBase cab file to a folder.

Download the AGDiag tool

To download AGDiag, follow these steps:

  1. Open Release AGDiag Windows Release October 2021 (signed).

  2. Select the agdiag.zip link to download the tool.

    Screenshot of selecting the agdiag.zip link to download the tool.

Launch AGDiag and feed it the unzipped TSS logs

Once the tool is downloaded, follow these steps to launch AGDiag and feed it the unzipped TSS logs:

  1. Extract the zip and double-click agdiag.exe to launch AGDiag.

    A dialog appears like the following one:

    Screenshot of running the AGDiag tool.

  2. Select Select Log Folder, drill into the folder you extracted the TSS SQL Base CAB files into, and then select OK.

Interpret the AGDiag report

The AGDiag report should be launched in the default system browser. The following illustrations help you interpret the report.

  • The following AGDiag Splash Screen describes AGDiag capabilities and version information:

    Screenshot of the AGDiag Splash Screen.

  • AGDiag reports on the logs analyzed in the initialize section. Select the triangles (highlighted in red boxes in the following image) to expand more detailed information.

    Screenshot of the AGDiag reports on the logs.

  • The summary report lists the availability group health events from the cluster log. Select the numerical link (highlighted in red box in the following image) to jump to a specific health event's detailed report.

    Screenshot of availability group health events.

  • There's a detailed report for each health event detected, which includes log findings that correlate to the health event, diagnosis, and recommendations. Select the triangles (highlighted in red boxes in the following image) to expand more detailed information.

    Screenshot of AlwaysOn health events.

Known issues with AGDiag

For the latest information on documented issues and possible solutions, see Known Issues with AGDiag.