如何使用PowerShell获取数据库的DTU百分比?
当前我正在运行查询
SELECT
AVG(avg_cpu_percent) AS 'Average CPU Utilization In Percent',
MAX(avg_cpu_percent) AS 'Maximum CPU Utilization In Percent',
AVG(avg_data_io_percent) AS 'Average Data IO In Percent',
MAX(avg_data_io_percent) AS 'Maximum Data IO In Percent',
AVG(avg_log_write_percent) AS 'Average Log Write Utilization In Percent',
MAX(avg_log_write_percent) AS 'Maximum Log Write Utilization In Percent',
AVG(avg_memory_usage_percent) AS 'Average Memory Usage In Percent',
MAX(avg_memory_usage_percent) AS 'Maximum Memory Usage In Percent'
FROM sys.dm_db_resource_stats;
字符串
但这需要每次都连接到数据库。有没有一个powershell命令我可以运行,将给予我的DTU百分比为一定的时间段?
1条答案
按热度按时间5n0oy7gb1#
如果度量名称未正确给出,则
Get-AzMetric
命令会出现 “Bad request” 错误。要使用PowerShell获取Azure数据库的DTU百分比,您需要提供指标名称为
dtu_consumption_percent
。**注意:**支持的数据库指标在MSDoc中列出,供您参考。
字符串
的数据
型
的
$Metrics.data
*。