【问题标题】:How can we get azure sql database metrics report in excel (cpu percentage,dtu percentage,deadlocks,failed connection) using powershell of last 7 days我们如何使用过去 7 天的 powershell 在 excel 中获取 azure sql 数据库指标报告(cpu 百分比、dtu 百分比、死锁、连接失败)
【发布时间】:2021-12-07 14:03:03
【问题描述】:

我必须使用所有 azure 订阅的 powershell 生成最近 7 天的性能数据库报告,其中包括 cpu 百分比、dtu 百分比、死锁、连接失败。请帮助我。

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
  • 请用谷歌搜索您的问题并提供一些基本的 Powershell 代码,并解释您遇到的问题

标签: azure powershell azure-sql-database metrics


【解决方案1】:

使用拥有图表数据的 Azure 门户是快速搜索和查询指标数据的一种方法。但是,您可以选择获取原始数据并自行查询。以下是用于获取此信息的 Powershell 示例。

在此其他页面中,您可能会发现其他潜在的指标名称作为参数传递 - Microsoft.Sql/servers/databases - here。

$MonitorParameters = @{
ResourceId = "/subscriptions/$($SubscriptionID)/resourceGroups/$($ResourceGroup)/providers/Microsoft.Sql/servers/$($ServerName)/databases/$($DBName)"
TimeGrain = $TimeGrain
MetricNames = $MetricName
StartTime = (Get-Date).AddDays($DaysToLook)
}
$Metrics = Get-AzMetric @MonitorParameters -DetailedOutput

时间戳平均指标


2020 年 7 月 10 日 11:07:00 0 dtu_consumption_percent 2020 年 7 月 10 日 11:07:00 10 dtu_limit
07/10/2020 11:07:00 0 dtu_used
2020 年 7 月 10 日 11:12:00 0 dtu_consumption_percent 2020 年 7 月 10 日 11:12:00 10 dtu_limit
07/10/2020 11:12:00 0 dtu_used
07/10/2020 11:17:00 19,6 dtu_consumption_percent

$metric = Get-AzMetric -ResourceId "/subscriptions/<subscription-id>/resourceGroups/<group-name>/providers/Microsoft.ClassicCompute/domainNames/<cloudservice-name>/slots/production/roles/WebRole1" -TimeGrain 00:15:00 -MetricName "Percentage CPU"
$metric.Data

使用 PowerShell 监控和扩展 Azure SQL 数据库中的单个数据库 | Here.

【讨论】:

    猜你喜欢
    • 2014-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多