Azure SQL数据库度量标准警报 - 如何使用PowerShell创建 [英] Azure SQL Database Metric alerts -- How to create with PowerShell

查看:63
本文介绍了Azure SQL数据库度量标准警报 - 如何使用PowerShell创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读创建,查看和管理指标提醒使用Azure监视器   Add-AzMetricAlertRule

I already read Create, view, and manage metric alerts using Azure Monitor and Add-AzMetricAlertRule.

如果我使用以下命令创建新的指标警报,警报仍会显示在经典警报下。 如何使用在新警报下注册而不是经典的PowerShell创建度量标准警报?

If I am creating a new metric alert using below command the alert still shows up under classic alert.  How can I create metric alert using PowerShell that register under new alert and not classic?

$ResourceGroup = 'taiobazdfdemo' $location = "East US 2" $server = 'taiobazdfdemo' $db = 'taiobazdfdemo' $rid = (Get-AzResource -ResourceGroupName $ResourceGroup -ResourceName "$server/$db").ResourceID $email = New-AzAlertRuleEmail -CustomEmail 'myemailaddress' -SendToServiceOwner

Add-AzMetricAlertRule
-Name'DTU90Check'`
-Location $ location`
-ResourceGroup $ ResourceGroup`
-TargetResourceId $ rid`
-MetricName'dtu_consumption_percent'`
-Operator GreaterThanOrEqual`
-Threshold 90`
-WindowSize '00:05:00 '
-TimeAggregationOperator最大值`
-Action $ email

Add-AzMetricAlertRule -Name 'DTU90Check' ` -Location $location ` -ResourceGroup $ResourceGroup ` -TargetResourceId $rid ` -MetricName 'dtu_consumption_percent' ` -Operator GreaterThanOrEqual ` -Threshold 90 ` -WindowSize '00:05:00' ` -TimeAggregationOperator Maximum ` -Action $email




 

推荐答案

你能尝试吗?相同但通过
Azure CLI
?我相信,如果创建的警报没有出现在度量警报的所需位置,则完全更新Azure门户中的所有Azure SQL功能需要进行一些更改。

Can you attempt the same but through the Azure CLI? I believe there are a few changes required to fully update all the Azure SQL functionality in the Azure Portal, if created alerts are not appearing in the desired location of Metric Alerts.

这是尝试。通过Portal访问Azure CLI并运行以下命令:

Here is something to try. Access the Azure CLI via the Portal and run the following command:

az monitor metrics alert list  -g taiobazdfdemo

您是否在Metric Alerts下列出了任何警报,或者它们都列在警报(经典)下?如果运行上述命令,您是否看到列出的任何警报(经典)?

Do you have any alerts listed under Metric Alerts or are they all listed under Alerts (Classic)? If you run the above command do you see any of the Alerts (Classic) listed?

如果您只看到列出的度量警报列出的警报而没有列出警报(经典),请使用以下命令cmd用于创建警报:

If you only see alerts listed from Metric Alerts and no Alerts (Classic) listed, then use the following cmd to create an alert:

az monitor metrics alert create -n {nameofthealert} -g {ResourceGroup} --scopes {VirtualMachineResourceID} --condition "avg Percentage CPU > 90" --description {descriptionofthealert}

查看
Azure Monitor中的度量标准警报支持的资源
,目前不支持Azure SQL具有较新警报的数据库,但似乎支持该服务的初始版本。请参阅:  Microsoft.Sql / servers / databases

In looking through the Supported resources for metric alerts in Azure Monitor, there is currently no support for Azure SQL Database with the newer alerts but there appears to be support for the initial release of the service. See: Microsoft.Sql/servers/databases

所以,你的命令看起来像:

So, your command would look like:

az monitor metrics alert create -n "DTU90Check" -g "taiobazdfdemo" --scopes "dtu_used" --condition "avg Percentage DTU > 90" --description "Check to see if the Avg DTU exceeds 90%."

我的想法是因为没有SQL模式使用新的度量标准警报服务,上面的内容将显示为警报(经典),而不是公制警报,但可能值得一试。 

My thinking is that because there are no SQL schema with the new Metric Alert service, this above will show up as a Alert (Classic) and not under Metric Alerts but might be worth a try. 


这篇关于Azure SQL数据库度量标准警报 - 如何使用PowerShell创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆