AzureMetrics 數據表的查詢
如需在 Azure 入口網站 中使用這些查詢的詳細資訊,請參閱Log Analytics教學課程。 如需 REST API,請參閱 查詢。
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 數據表中的特定值。/nNote 指出此查詢需要更新 <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 數據表中的特定值。/nNote 指出此查詢需要更新 <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 線路位InPerSecond 流量圖表
流量圖表 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 數據表的記錄
列出 AzureMetrics 數據表中的最新記錄,依時間排序(最新第一個)。
AzureMetrics
| top 10 by TimeGenerated
顯示來自 AzureMetrics 數據表的記錄
列出 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)