HI @Razzi29,
To monitor database replication to a SQL Managed Instance using Application Insights and set up alerts for when the database hasn't replicated for more than 12 hours, you can follow these steps:
- Set Up Application Insights: Ensure that Application Insights is properly configured for your SQL Managed Instance. This will allow you to collect telemetry data.
- Custom Telemetry: Since the replication is managed by a third-party provider and you have no control over it, you may need to implement custom telemetry to log the last replication time. This can be done by creating a scheduled job or function that checks the last replication timestamp and sends this data to Application Insights.
- Create an Alert Rule:
- In Azure Monitor, navigate to Alerts.
- Select Create and then choose Alert rule.
- Set the scope to your Application Insights resource.
- For the condition, you can create a log query that checks if the last replication time is older than 12 hours. You might use a query similar to:
customEvents | where name == "ReplicationEvent" | summarize LastReplicationTime = max(timestamp) | where LastReplicationTime < ago(12h)
- Set the action group to notify you via email or another method when the alert is triggered.
Reference:
Please feel free to let us know, as we are always here to help whenever you need us.
Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.