如果我們之前沒有啟用性能計數器數據,則可以在Log Analytics Workspace中單擊“ 高級設置”,再單擊“ 數據”,現在單擊“ Windows性能計數器”,最后單擊“ 添加選定的性能計數器”:
查詢收集到的數據
我們可以使用如下查詢語句從我們收集到的數據中查詢出系統的CPU使用率:
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total" and Computer in ((Heartbeat
| distinct Computer))
| summarize PCT95CPUPercentTime = percentile(CounterValue, 95) by Computer
| summarize max(PCT95CPUPercentTime) by Computer
| join
(
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total" and Computer in ((Heartbeat
| distinct Computer))
)
on Computer
| make-series PCT95CPUPercentTime = percentile(CounterValue, 95) on TimeGenerated from ago( 5h ) to now() step 10m by Computer
| render timechart
也可以使用如下語句來查看CPU使用率大于某個值的機器:
let setpctValue = 3;
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total" and Computer in ((Heartbeat
| distinct Computer))
| summarize PCT95CPUPercentTime = percentile(CounterValue, 95) by Computer
| where PCT95CPUPercentTime > setpctValue
| summarize max(PCT95CPUPercentTime) by Computer
| join
(
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total" and Computer in ((Heartbeat
| distinct Computer))
)
on Computer
| make-series PCT95CPUPercentTime = percentile(CounterValue, 95) on TimeGenerated from ago( 5h ) to now() step 10m by Computer
| render timechart
將性能圖表固定到儀表板
若想將我們所查詢出來的圖表固定到Azure Dashboard,可以點擊查詢窗口右上方的“固定”按鈕,然后選擇我們要將圖標展示在那個Dashboard。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。