SOLVED
Home

How to get the Peak CPU on Log Analytics

%3CLINGO-SUB%20id%3D%22lingo-sub-481186%22%20slang%3D%22en-US%22%3EHow%20to%20get%20the%20Peak%20CPU%20on%20Log%20Analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481186%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20team%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20need%20to%20get%20the%20avg%20of%20cpu%20for%20VMs%20and%20this%20I%20know%20how%20get%20this%2C%20but%20I%20also%20need%20another%20thing%20that's%20the%20Peak%20of%20CPU%2C%20to%20checking%20if%20I%20don't%20have%20any%20false%20positive.%3C%2FP%3E%0A%3CP%3EThe%20end%20game%20is%20looking%20for%20CPU%20consumption%20during%20the%20month%20and%20get%20the%20VMs%20that%20the%20CPU%20consumption%20is%20%26lt%3B%202%25%2C%20to%20decommission.%3C%2FP%3E%0A%3CP%3ETks%20so%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-481186%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481226%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20Peak%20CPU%20on%20Log%20Analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481226%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%2C%20tks%20for%20your%20help.%3C%2FP%3E%0A%3CP%3EI'll%20follow%20your%20points%2C%20I'm%20also%20have%20a%20lot%20of%20VMs%20and%20many%20teams%20here%2C%20some%20times%2C%20estimates%20an%20big%20VM%20for%20one%20little%20service%20consumption%20and%20this%20will%20help%20to%20view%20what's%20the%20VMs%20and%20I%20can%20use%20with%20evidence%20to%20resize%20or%20decommission%20those%20VM.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETks%20so%20much%20again%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481204%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20get%20the%20Peak%20CPU%20on%20Log%20Analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481204%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F115965%22%20target%3D%22_blank%22%3E%40Lucas%20Chies%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20CPU%20examples%20-%20you%20can%20launch%20from%20the%20portal%2C%20like%20this%20one%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20490px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F109956i4714FC8B960D1A84%2Fimage-dimensions%2F490x488%3Fv%3D1.0%22%20width%3D%22490%22%20height%3D%22488%22%20alt%3D%22Annotation%202019-04-23%20150944.png%22%20title%3D%22Annotation%202019-04-23%20150944.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20I'd%20decommission%20a%20server%20based%20on%20%3CSTRONG%3Ejust%3C%2FSTRONG%3Elow%20CPU%20use.%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI'd%20amend%20the%20query%20like%20this%20(you%20can%20also%20replace%20%22avg%22%20with%20%22max%22%20).%26nbsp%3B%20I%20added%20in%20a%20filter%20for%20%26lt%3B%2010%25%20only%20(you%20can%20use%202%25)%20and%20a%20filter%20for%20machines%20that%20names%20start%20with%20%22A%22%20as%20I%20have%20a%20lot%20of%20servers%20%3A)%3C%2Fimg%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CPRE%3E%2F%2F%20CPU%20usage%20trends%20over%20the%20last%20day%0A%2F%2F%20Calculate%20CPU%20usage%20patterns%20across%20all%20computers%2C%20chart%20by%20percentiles%0APerf%0A%7C%20where%20Computer%20startswith%20%22A%22%20%0A%7C%20where%20ObjectName%20%3D%3D%20%22Processor%22%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20and%20InstanceName%20%3D%3D%20%22_Total%22%0A%7C%20where%20CounterValue%20%26lt%3B%2010%0A%7C%20summarize%20avg(CounterValue)%20by%20bin(TimeGenerated%2C%201h)%20%2C%20Computer%0A%7C%20render%20timechart%3C%2FPRE%3E%0A%3CP%3Ee.g.%26nbsp%3B%20Computers%20less%20than%202%25%20in%20past%2031days%20-%20none%20of%20which%20I'd%20decommission%20as%20they%20are%20low%20use%2C%20and%20I%20know%20why.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F109960i15151A5476827CBA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Annotation%202019-04-23%20152447.png%22%20title%3D%22Annotation%202019-04-23%20152447.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Lucas Chies
New Contributor

Hello team,

 

I need to get the avg of cpu for VMs and this I know how get this, but I also need another thing that's the Peak of CPU, to checking if I don't have any false positive.

The end game is looking for CPU consumption during the month and get the VMs that the CPU consumption is < 2%, to decommission.

Tks so much.

2 Replies
Solution

@Lucas Chies 

 

There are CPU examples - you can launch from the portal, like this one:

 


Annotation 2019-04-23 150944.png

I'm not sure I'd decommission a server based on just low CPU use.  

I'd amend the query like this (you can also replace "avg" with "max" ).  I added in a filter for < 10% only (you can use 2%) and a filter for machines that names start with "A" as I have a lot of servers :)

// CPU usage trends over the last day
// Calculate CPU usage patterns across all computers, chart by percentiles
Perf
| where Computer startswith "A" 
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where CounterValue < 10
| summarize avg(CounterValue) by bin(TimeGenerated, 1h) , Computer
| render timechart

e.g.  Computers less than 2% in past 31days - none of which I'd decommission as they are low use, and I know why.

Annotation 2019-04-23 152447.png

 

 

Highlighted

Hello @Clive Watson , tks for your help.

I'll follow your points, I'm also have a lot of VMs and many teams here, some times, estimates an big VM for one little service consumption and this will help to view what's the VMs and I can use with evidence to resize or decommission those VM.

 

Tks so much again