Forum Discussion
Dante Nahuel Ciai
Oct 08, 2020Brass Contributor
Help understanding Processor counters
Hi all I'm trying to create a good query for Log Analytics to measure CPU average usage and peaks in order to determine whether the VM is under/over utilized. For a long time I've been using this...
- Oct 12, 2020
The right query will be:
Perf | where CounterName =~ '% Processor Time' and ObjectName =~ 'Processor' and InstanceName =~ '_Total' | summarize AggregatedValue = avg(CounterValue) by _ResourceId
or if you have on-premises VMs
Perf | where CounterName =~ '% Processor Time' and ObjectName =~ 'Processor' and InstanceName =~ '_Total' | summarize AggregatedValue = avg(CounterValue) by Computer
Basically you only need _Total values for the counter. Besides average you can also use percentile() . I am not sure how max() will work for you as you can have a VM that once had for a second CPU at 100% and then all the time it was as low as 1%. Overall it depends on your logic and what kind of analysis you want to do.
Scott_Kinghorn
Microsoft
Oct 21, 2020Hi Dante, there are a couple of workbooks that we ship in Azure Monitor that may help. Azure Portal>Monitor>Workbooks>Virtual Machine ... the one named Performance Analysis uses data collected by AzMon for VMs in the InsightsMetrics table. The one named Perf Counters offers a similar view but uses the Perf table. You can choose the counter of interest and multiple ways of aggregating the data (e.g. avg, P80, P95) as well as which aggregation to use for the trend line. Cheers, Scott