在Azure中,如何配置SQL Server故障转移发生时的警报或通知? [英] In Azure, how can you configure an alert or notification when a SQL Server failover happened?
本文介绍了在Azure中,如何配置SQL Server故障转移发生时的警报或通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Azure中,如果使用故障转移组设置SQL Server并将故障转移策略设置为自动,那么如何在发生SQL Server故障转移时配置警报或通知?如果无法在Monitor中进行设置,是否可以在其他地方编写脚本?
In Azure, how can you configure an alert or notification when a SQL Server failover happened if you setup a SQL server with Failover groups and failover policy is set to automatic? If it can't be setup in Monitor can it be scripted elsewhere?
推荐答案
找到了一种使用自动化在Azure中编写脚本的方法帐户> Runbook>使用Powershell。像这样的简单脚本应该可以做到。只需找出运行方式帐户并按计划或警报触发即可。
Found a way to script this in Azure using Automation Accounts > Runbook > using Powershell. A simple script like this should do it. Just need to figure out the run as account and trigger it by schedule or alert.
function sendEmailAlert
{
# Send email
}
function checkFailover
{
$list = Get-AzSqlDatabaseFailoverGroup -ResourceGroupName "my-resourceGroup" -server "my-sql-server"
if ( $list.ReplicationRole -ne 'Primary')
{
sendEmailAlert
}
}
checkFailover
这篇关于在Azure中,如何配置SQL Server故障转移发生时的警报或通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文