Log Analytics에서 다음 경고를 만들었습니다. 경고는 지난 10분 동안 _Total CPU 사용량이 90%를 초과한 모든 컴퓨터를 가져오도록 설계되었습니다. 그러나 경고를 실행하면 오류가 발생합니다.
'join' 연산자: 'FindCPU'라는 테이블 또는 열 식을 확인하지 못했습니다.
누군가 이 문제를 해결하는 데 무엇이 필요할 수 있는지 알려줄 수 있나요?
//Find Top processes utilizing CPU
// by finding the machine(s) using over 90% of CPU
// then finding the processes using the CPU
// also finding CPU count of the machines to find the actual percentage of CPU being used
//defining our CPU threshold
let CPUThreshold = 90;
//define time sample rate
let Time = 10m;
//define Count of processes to return
let Count = 5;
//Find instances of total cpu being used above 90% over the last 10 minutes
let TopCPU = Perf
| where TimeGenerated > now(-Time)
and ObjectName == "Processor"
and CounterName == "% Processor Time"
and InstanceName == "_Total"
and CounterValue > CPUThreshold
| project Computer, ObjectName
, CounterName, CounterValue
, TimeGenerated;
//end query
// find top Processes, excluding _Total and Idle instances, there may be other instances you want to exclude as well
let TopProcess = Perf
| where TimeGenerated > now(-Time)
and CounterName == "% Processor Time"
and InstanceName != "_Total"
and InstanceName != "Idle"
| project Computer, ObjectName
, CounterName, InstanceName
, CounterValue, TimeGenerated;
// end query
// find CPU count for servers(s)
let FindCPU = Perf
| where TimeGenerated >= ago(1h)
| where ObjectName == "Processor"
and CounterName == "% Processor Time"
and InstanceName!="_Total"
| sort by InstanceName asc nulls first
| summarize CPUCount = dcount(InstanceName) by Computer;
// end query
//Join all 3 datasets together
FindCPU | join(TopCPU) on Computer
| join(TopProcess)on Computer
| extend PercentProcessorUsed = CounterValue1 / CPUCount
| summarize avg(PercentProcessorUsed) by Computer, ObjectName
, CounterName, CPUCount
, TotalCPU=CounterValue //rename CounterValue to TotalCPU
, Process=ObjectName1 //rename ObjectName1 to Process
, ProcessTime=CounterName1 //rename CounterName1 to ProcessTime
, ProcessName=InstanceName //rename InstanceName to ProcessName
, TimeGenerated
| where Process == "Process"
and avg_PercentProcessorUsed > 25 // only return processes that are using more than 25%
| top Count by avg_PercentProcessorUsed desc
| project Computer, CPUCount
, ProcessName , avg_PercentProcessorUsed
, TotalCPU, Process
, ProcessTime, TimeGenerated
감사해요
답변1
쿼리는 잘 실행되지만(수행하려는 작업에 비해 다소 복잡해 보이지만) 쿼리를 실행할 때 모든 쿼리를 선택했는지 확인해야 합니다.
기본적으로 커서가 모든 쿼리 끝에 있는 경우 Log Analytics는 마지막 쿼리만 실행합니다. 이는 "FindCPU"를 찾을 수 없기 때문에 분명히 오류가 발생합니다. 모든 것을 강조 표시한 다음 실행하면 제대로 작동합니다.