Monitor status of WindowsAgent.SqlServer Azure Arc Extension

Lorenzo Dalla Pozza 20 Reputation points
2024-09-03T13:53:59.6533333+00:00

Hi everyone,

I'm currently working with Azure Arc and have registered my machines with the "WindowsAgent.SqlServer" extension for monitoring and billing of Microsoft SQL Server instances.

While I can verify the Arc agent heartbeat using Azure Monitoring Logs, I'm struggling to find a way to monitor if the extension is actually communicating with Azure. This could be a potential indicator of underlying issues with the SQL instance.

I've noticed that the Azure Arc extensions menu displays the following message: "Extension Message: SQL Server Extension Agent: Healthy; timestampUTC : 2024/09/03, 13:31:05.901; uploadStatus : OK; uploadMessage : "Upload succeeded."; telemetryUploadStatus : {"logs":null,"dmv":null,"ma":null};AutomaticBackups: Running;PurviewPlugin: {};AzureActiveDirectoryPlugin: {

"MSSQLSERVER": ""

}, AutomaticBackups: {"$type":"Microsoft.Azure.Hybrid.Sql.Models.AutomaticSqlBackupConfiguration, SqlAgent","retentionPeriodInDays":7,"profiles":{"$type":"System.Collections.Generic.List`1[[Microsoft.Azure.Hybrid.Sql.Azure.Models.ShortTermRetentionAutomaticSqlBackupProfile, SqlAgent]], System.Private.CoreLib","$values":[]}}, Purview plugin: [], Azure active directory configuration plugin: [], Assessment: [], Assessment Status: {"AssessmentHistory":[],"AssessmentHistory":[],"Enabled":false,"ErrorMessage":"","NextScheduledTime":null,"RunStatus":"NotRunning","StartTime":null}."

It seems like this information is being tracked on Azure, and I believe I could extract it from the "Logs" to create a custom metric.

Does anyone have experience with monitoring this specific extension and can provide some guidance on how to extract this data and create a custom metric?

Thanks in advance,

Lorenzo

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
402 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,672 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 10,036 Reputation points
    2024-09-03T20:45:24.07+00:00

    Hello Lorenzo Dalla Pozza,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Regarding your explanation and question, I understand that you would like to monitor the WindowsAgent.SqlServer extension in Azure Arc and also create a custom metric for communication status.

    To achieve your goal, try to understand that from the message you shared, it looks like the extension is providing many key pieces of information such as Extension Health, Upload Status, Telemetry Upload Status, Automatic Backups, Purview Plugin, AAD Plugin Status and so forth. So, you will need to create a custom metric, that will extract and analyze data from Azure Monitor Logs (Log Analytics) and this will help to query the logs for the relevant status data provided by the extension.

    Secondly, you can query Azure Monitor Logs by navigate to Log Analytics Workspace or run a Kusto Query Language (KQL) Query to filters logs for the specific extension and projects relevant fields.

    • Log Analytics Workspace:
      • Go to the Azure Portal.
      • Navigate to your Log Analytics workspace where Azure Arc logs are collected.
    • Kusto Query Language (KQL) Query
      • You’ll need to write a KQL query to extract the data related to the WindowsAgent.SqlServer extension status as it shown below:
     AzureDiagnostics
       | where ResourceType == "MICROSOFT.HYBRIDCONNECTION/CONNECTIONS"
       | where Category == "ExtensionLogs" // Adjust based on actual category
       | where ExtensionName_s == "WindowsAgent.SqlServer"
       | project TimeGenerated, ExtensionStatus_s, UploadStatus_s, TelemetryUploadStatus_s, AutomaticBackups_s
    

    Now, if you want to create a custom metric based on the extension’s status here is a simple guide.

    • In Azure Monitor, go to “Alerts.”
    • Click on “+ New alert rule.”
    • Choose the appropriate scope (your Log Analytics workspace).
    • Under “Condition,” use the custom KQL query to define the condition for your metric.
    • Set up the logic to trigger an alert based on the extracted data. For instance, you could set up an alert if the extension's UploadStatus is not "OK" for a certain period.
    • Define who should be notified and how (email, SMS, webhook, etc.) if the alert is triggered.

    For more revie and steps you can use this best resource links: https://docs.microsoft.com/en-us/azure/azure-monitor and https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.