Hello @Karan Bhatt Thank you for posting your question on Microsoft Q&A platform. Happy to help!
From your post, I understand that you want to set up alerts for Test Failover and Agent status in Azure Site Recovery Service.
Yes, you can set up alerts for "Last Successful Test Failover" and for the agent status in Azure Recovery Services. Here's how you can achieve this:
- Set up a Log Analytics workspace: To set up alerts for Azure Recovery Services, you need to create a Log Analytics workspace. This workspace will collect and analyze the data from your Azure Recovery Services vault.
- Configure data collection: Once you have set up the Log Analytics workspace, you need to configure data collection for your Azure Recovery Services vault. This will allow the workspace to collect data about your vault, including the "Last Successful Test Failover" and agent status.
- Create an alert rule: After you have configured data collection, you can create an alert rule in the Log Analytics workspace. You can create an alert rule for "Last Successful Test Failover" by using the following query:
AzureDiagnostics | where Category == "SiteRecoveryVaultEvents"
| where OperationName == "TestFailoverCleanupSucceeded"
| where Result == "Succeeded"
| summarize arg_max(TimeGenerated, *) by ResourceId
This query will return the last successful test failover for each Azure Recovery Services vault. You can then set up an alert rule to trigger when the "Last Successful Test Failover" is in a warning state.
To create an alert rule for the agent status, you can use the following query:
AzureDiagnostics | where Category == "SiteRecoveryVaultEvents"
| where OperationName == "AgentStatusChanged"
| where Result == "Warning" or Result == "Unhealthy"
| summarize arg_max(TimeGenerated, *) by ResourceId
This query will return the last agent status change for each Azure Recovery Services vault. You can then set up an alert rule to trigger when the agent status is in a warning or unhealthy state.
Reference doc: https://learn.microsoft.com/en-us/azure/site-recovery/site-recovery-monitor-and-troubleshoot
Hope this helps. If you have any further questions, do let us know.
If the response helped, do "Accept Answer" and up-vote it