다음을 통해 공유


Perf 테이블에 대한 쿼리

Azure Portal에서 이러한 쿼리를 사용하는 방법에 대한 자세한 내용은 Log Analytics 자습서를 참조하세요. REST API는 쿼리를 참조하세요.

비 RDMA 작업

컴퓨터의 비 RDMA 작업을 확인합니다.

//Select your log analytics workspace and replace enter nodename with the name of the node within a cluster on which you want to set the alert for Non-RDMA activity
Perf
| where ObjectName == "Network Interface"
| extend Nodename= tostring(split(Computer, ".")[0])
| where Nodename =~'enter nodename'
| summarize NetworkUsage = sum(CounterValue), Nodename = any(Nodename) by TimeGenerated
| summarize arg_max(TimeGenerated, Nodename, NetworkUsage)

RDMA 작업

컴퓨터의 RDMA 작업을 확인합니다.

//Select log analytics workspace and replace enter nodename with the name of the machine on which you want to set the alert for RDMA activity
Perf
| where ObjectName == "RDMA Activity"
| extend Nodename= tostring(split(Computer, ".")[0])
| where Nodename =~'enter nodename'
| summarize RdmaUsage = sum(CounterValue), Nodename = any(Nodename) by TimeGenerated
| summarize arg_max(TimeGenerated, Nodename, RdmaUsage)

어떤 데이터가 수집되나요?

수집된 성능 카운터와 개체 유형(프로세스, 메모리, 프로세서)을 나열합니다.

Perf
| summarize by ObjectName, CounterName

메모리 및 CPU 사용량

지난 1시간 동안 모든 컴퓨터에서 사용된 메모리와 CPU를 차트로 표시합니다.

Perf
| where TimeGenerated > ago(1h)
| where (CounterName == "% Processor Time" and InstanceName == "_Total") or CounterName == "% Used Memory"
| project TimeGenerated, CounterName, CounterValue
| summarize avg(CounterValue) by CounterName, bin(TimeGenerated, 1m)
| render timechart

모든 컴퓨터의 CPU 사용 패턴을 계산하고 백분위수별로 차트를 작성합니다.

Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| summarize percentiles(CounterValue, 50, 90, 99) by bin(TimeGenerated, 1h)
| render timechart

디스크 공간이 가장 많은 상위 10대 컴퓨터

사용 가능한 디스크 공간이 가장 많은 상위 10개의 컴퓨터를 표시합니다.

Perf
| where CounterName == "Free Megabytes" and InstanceName == "_Total"
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue

어떤 데이터가 수집되나요?

수집된 성능 카운터와 개체 유형(프로세스, 메모리, 프로세서 등) 나열

Perf
| summarize by ObjectName, CounterName

가상 머신 사용 가능 메모리

시간에 따른 VM의 사용 가능한 메모리를 차트로 표시합니다.

// To create an alert for this query, click '+ New alert rule'
Perf
| where ObjectName == "Memory" and
(CounterName == "Available MBytes Memory" or // the name used in Linux records
CounterName == "Available MBytes") // the name used in Windows records
|  summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId // bin is used to set the time grain to 15 minutes
| render timechart

지난 하루 동안의 CPU 사용 패턴을 계산하여 백분위수별로 차트를 작성합니다.

// To create an alert for this query, click '+ New alert rule'
Perf
| where CounterName == "% Processor Time"
| where ObjectName == "Processor"
| summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId // bin is used to set the time grain to 15 minutes
| render timechart
// Perf table stores performance counters for Windows and Linux computers
// Counters are specified using ObjectName (performance object), InstanceName and CounterName
// % Processor Time captures CPU activity, ObjectNames can be Processor, Process and Process Information

가상 머신의 여유 디스크 공간

인스턴스별로 최신 디스크 여유 공간 보고서를 표시합니다.

// To create an alert for this query, click '+ New alert rule'
Perf
| where ObjectName == "LogicalDisk" or // the object name used in Windows records
ObjectName == "Logical Disk" // the object name used in Linux records
| where CounterName == "Free Megabytes"
| summarize arg_max(TimeGenerated, *) by InstanceName // arg_max over TimeGenerated returns the latest record
| project TimeGenerated, InstanceName, CounterValue, Computer, _ResourceId

CPU 사용률 기준 상위 10개 가상 머신

지난 7일간 CPU 사용률 상위 10개 VM을 찾습니다.

Perf
| where TimeGenerated > ago(7d)
| where CounterName == "% Processor Time" and InstanceName == "_Total" 
| project TimeGenerated, Computer, ObjectName, CounterName, InstanceName, round(CounterValue, 2)
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue

하위 10개 여유 디스크 공간 %

지난 7일 동안 컴퓨터의 사용 가능한 디스크 공간(%) 하위 10개입니다.

Perf
| where TimeGenerated > ago(7d)
| where (ObjectName == "Logical Disk" or ObjectName == "LogicalDisk") and CounterName contains "%" and InstanceName != "_Total" and InstanceName != "HarddiskVolume1"
| project TimeGenerated, Computer, ObjectName, CounterName, InstanceName, CounterValue 
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue desc

컨테이너 CPU

30분 동안의 모든 컨테이너 CPU 사용량을 평균적으로 확인합니다.

// To create an alert for this query, click '+ New alert rule'
//Select the Line chart display option: can we calculate percentage?
Perf
| where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
| summarize AvgCPUUsageNanoCores = avg(CounterValue) by bin(TimeGenerated, 30m), InstanceName, _ResourceId

컨테이너 메모리

30분 간격으로 컨테이너 CPU 평균을 봅니다.

// To create an alert for this query, click '+ New alert rule'
//Select the Line chart display option: can we calculate percentage?
let threshold = 75000000; // choose a threshold 
Perf
| where ObjectName == "K8SContainer" and CounterName == "memoryRssBytes"
| summarize AvgUsedRssMemoryBytes = avg(CounterValue) by bin(TimeGenerated, 30m), InstanceName, _ResourceId
| where AvgUsedRssMemoryBytes > threshold 
| render timechart

인스턴스 평균 CPU 사용량이 지난주 대비 증가했습니다.

지난주 인스턴스별 평균 CPU 증가율을 내림차순으로 표시합니다.

// To create an alert for this query, click '+ New alert rule'
//Show which instances grew CPU usage from last week to current
Perf
| where TimeGenerated > ago(7d) //This week Average CPU Usage Nano Cores
| where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
| summarize ThisWeekAvgCPU = avg(CounterValue) by InstanceName, _ResourceId
| join kind= leftouter (
    //Previous week Average CPU Usage Nano Cores
    Perf
    | where TimeGenerated > ago(14d) and TimeGenerated <= ago(7d)
    | where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
    | summarize PrevWeekAvgCPU = avg(CounterValue) by InstanceName, _ResourceId
) on InstanceName, _ResourceId
| extend InstanceNameParts = split(InstanceName, "/")  //array of the parts of the instance name
| extend ShortInstanceName = InstanceNameParts[(array_length(InstanceNameParts)-1)] //extract the last part of the instance name
| extend ThisWeekAvgCPU = round(ThisWeekAvgCPU,0) 
| extend PrevWeekAvgCPU = round(iff(isempty(PrevWeekAvgCPU),0.0,PrevWeekAvgCPU),0) //When doing join with kind=leftouter, missing matches has empty value. To calculate growth, it should be converted to zero. In this case, empty value means that instance did not exist in the previous week
| extend AvgCPUGrowth = round(ThisWeekAvgCPU - PrevWeekAvgCPU , 0) //Calculate growth
| project-away InstanceName1,InstanceNameParts //Remove redundant fields
| order by AvgCPUGrowth desc 

Perf에서 찾기

Perf 테이블에서 특정 값을 검색하려면 Perf에서 찾기를 사용합니다./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.
Perf
| where * contains tostring(SearchValue)
| take 1000