AzureMetrics 表的查询
HTTP 响应代码的饼图
过去 12 小时内每个指标的响应代码明细。
AzureMetrics
| where TimeGenerated > ago(12h)
| where MetricName in ("Http2xx", "Http3xx", "Http4xx", "Http5xx")
| summarize sum(Total) by MetricName
| render piechart
响应时间的折线图
平均响应时间的时序 (间隔超过 5 分钟) 。
AzureMetrics
| extend timeBin = bin(TimeGenerated, 5m)
| summarize ResponseTime = sumif(Average, MetricName=="AverageResponseTime") by timeBin, bin(TimeGenerated, 1h)
| sort by TimeGenerated desc
| render timechart
[经典]在 AzureMetrics 中查找
[经典]在 AzureMetrics 中查找以在 AzureMetrics 表中搜索特定值。/n请注意,此查询需要更新 <SeachValue> 参数才能生成结果
// This query requires a parameter to run. Enter value in SearchValue to find in table.
let SearchValue = "<SearchValue>";//Please update term you would like to find in the table.
AzureMetrics
| where * contains tostring(SearchValue)
| take 1000
最新指标
显示每个报告指标的最新指标报告。
AzureMetrics
| summarize arg_max(TimeGenerated, UnitName, Total, Count, Maximum, Minimum, Average) by MetricName
在 AzureMetrics 中查找
在 AzureMetrics 中查找以在 AzureMetrics 表中搜索特定值。/n请注意,此查询需要更新 <SeachValue> 参数才能生成结果
// This query requires a parameter to run. Enter value in SearchValue to find in table.
let SearchValue = "<SearchValue>";//Please update term you would like to find in the table.
AzureMetrics
| where * contains tostring(SearchValue)
| take 1000
ExpressRoute 线路 BitsInPerSecond 流量图
流量图 BitsInPerSecond (过去一小时) 。
AzureMetrics
| where MetricName == "BitsInPerSecond"
| summarize by Average, bin(TimeGenerated, 1h), Resource
| render timechart
ExpressRoute 线路 BitsOutPerSecond 流量图
流量图 BitsOutPerSecond (过去一小时) 。
AzureMetrics
| where MetricName == "BitsOutPerSecond"
| summarize by Average, bin(TimeGenerated, 1h), Resource
| render timechart
ExpressRoute 线路 ArpAvailablility 图
ArpAvailability (5 分钟) 的流量图。
AzureMetrics
| where MetricName == "ArpAvailability"
| summarize by Average, bin(TimeGenerated, 5m), Resource
| render timechart
ExpressRoute 线路 BGP 可用性
BgpAvailability () 5 分钟的流量图。
AzureMetrics
| where MetricName == "BgpAvailability"
| summarize by Average, bin(TimeGenerated, 5m), Resource
| render timechart
CPU 使用率平均值
按资源名称显示过去一小时平均 CPU 使用率。
//consistently high averages could indicate a customer needs to move to a larger SKU
AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL" // /DATABASES
| where TimeGenerated >= ago(60min)
| where MetricName in ('cpu_percent')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource // subtract Resource name for _ResourceId
| summarize CPU_Maximum_last15mins = max(Maximum), CPU_Minimum_last15mins = min(Minimum), CPU_Average_last15mins = avg(Average) by Resource , MetricName
性能故障排除
系统可能会查询或死锁,从而导致性能不佳。
//potentially a query or deadlock on the system that could lead to poor performance
AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >=ago(60min)
| where MetricName in ('deadlock')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource // subtract Resource name for _ResourceId
| summarize Deadlock_max_60Mins = max(Maximum) by Resource, MetricName
加载数据
监视过去一小时的数据加载。
AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >= ago(60min)
| where MetricName in ('log_write_percent')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource// subtract Resource name for _ResourceId
| summarize Log_Maximum_last60mins = max(Maximum), Log_Minimum_last60mins = min(Minimum), Log_Average_last60mins = avg(Average) by Resource, MetricName
P2S 连接计数
过去 30 天的活动 P2S 连接计数。
AzureMetrics
| where TimeGenerated > ago(30d)
| where MetricName == "P2SConnectionCount"
| summarize by Maximum, bin(TimeGenerated,1h), Resource
| render timechart
P2S 带宽利用率
过去 12 小时内的平均 P2S 带宽利用率(以位/秒为单位)。
AzureMetrics
| where TimeGenerated > ago(24h)
| where MetricName == "P2SBandwidth"
| summarize by Average, bin(TimeGenerated, 1h), Resource
| render timechart
网关吞吐量
聚合网关吞吐量(以字节/秒为单位)。
AzureMetrics
| where TimeGenerated > ago(24h)
| where MetricName == "AverageBandwidth"
| summarize by Average, bin(TimeGenerated, 1h), Resource
| render timechart
显示 AzureMetrics 表中的日志
Lists AzureMetrics 表中的最新日志,按时间 (最新第一) 排序。
AzureMetrics
| top 10 by TimeGenerated
显示 AzureMetrics 表中的日志
Lists AzureMetrics 表中的最新日志,按时间 (最新第一) 排序。
AzureMetrics
| top 10 by TimeGenerated
群集可用性 (KeepAlive)
显示群集在过去一小时内的可用性。
// To create an alert for this query, click '+ New alert rule'
AzureMetrics
| where ResourceProvider == "MICROSOFT.KUSTO"
| where TimeGenerated > ago(1d)
| where MetricName == "KeepAlive"
| parse _ResourceId with * "providers/microsoft.kusto/clusters/" cluster_name // Get the cluster name from the ResourceId string
| summarize heartbeat_count = count() by bin(TimeGenerated, 30m), cluster_name // bin is used to set the time grain to 30 minutes
| extend alive=iff(heartbeat_count > 0, true, false)
| sort by TimeGenerated asc // sort the results by time (ascending order)
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈