【问题标题】:How to configure the alert whenever the primary Azure SQL Database goes down?每当主 Azure SQL 数据库出现故障时,如何配置警报?
【发布时间】:2019-06-24 06:09:57
【问题描述】:

在 Azure 中,当您设置了带有故障转移组的 SQL Server 并且故障转移策略设置为自动时,如何在发生 SQL Server 故障转移时配置警报或电子邮件通知?

那么,谁能建议我如何为上述场景配置警报?

【问题讨论】:

    标签: azure azure-sql-database azure-sql-server azure-monitoring sql-azure-alerts


    【解决方案1】:

    您参考了这个博客:In Azure, how can you configure an alert or notification when a SQL Server failover happened?

    CKelly 找到了一种在 Azure 中使用自动化帐户 > Runbook > 使用 Powershell 编写脚本的方法。像这样的简单脚本应该可以做到。只需要弄清楚 run as account 并通过 schedule 或 alert 触发它。:

    function sendEmailAlert
    {
        # Send email
    }
    
    
    function checkFailover
    {
        $list = Get-AzSqlDatabaseFailoverGroup -ResourceGroupName "my-resourceGroup" -server "my-sql-server"
    
        if ( $list.ReplicationRole -ne 'Primary')
        { 
            sendEmailAlert
        }
    }
    
    checkFailover
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-22
      • 1970-01-01
      • 1970-01-01
      • 2012-06-25
      • 2018-03-15
      • 1970-01-01
      相关资源
      最近更新 更多