Home

Query for Percent Memory Used

%3CLINGO-SUB%20id%3D%22lingo-sub-674768%22%20slang%3D%22en-US%22%3EQuery%20for%20Percent%20Memory%20Used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-674768%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Guys%2C%3C%2FP%3E%3CP%3ECan%20someone%20give%20me%20the%20azure%20log%20analytics%20Query%20which%20will%20provide%20me%20the%20Memory%20(RAM)%20usage%20in%20percentage%20(Percent%20Memory%20Used)%20of%20all%20Virtual%20machines.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-674768%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-675945%22%20slang%3D%22en-US%22%3ERe%3A%20Query%20for%20Percent%20Memory%20Used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-675945%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F338025%22%20target%3D%22_blank%22%3E%40roopesh_shetty%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20is%20an%20example%20on%20the%20logs%20home%20page%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%2F117378iDD4964FF791F55DF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Annotation%202019-06-06%20195310.jpg%22%20title%3D%22Annotation%202019-06-06%20195310.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20does%20have%20CPU%20info%20as%20well%2C%20but%20if%20you%20edit%20that%20out%20you%20have%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%2F%2F%20Memory%20usage%0A%2F%2F%20Chart%20all%20computers'%20used%20memory%20%20over%20the%20last%20hour%0APerf%0A%7C%20where%20TimeGenerated%20%26gt%3B%20ago(1h)%0A%7C%20where%20%20CounterName%20%3D%3D%20%22%25%20Used%20Memory%22%20%0A%7C%20project%20TimeGenerated%2C%20CounterName%2C%20CounterValue%20%0A%7C%20summarize%20avg(CounterValue)%20by%20CounterName%2C%20bin(TimeGenerated%2C%201m)%0A%7C%20render%20timechart%3C%2FPRE%3E%0A%3CP%3ENote%3A%20you%20have%20to%20collect%26nbsp%3B%22%25%20Used%20Memory%22%26nbsp%3B%20in%20log%20Analytics%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fplatform%2Fdata-sources-performance-counters%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fplatform%2Fdata-sources-performance-counters%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
roopesh_shetty
Occasional Contributor

Hi Guys,

Can someone give me the azure log analytics Query which will provide me the Memory (RAM) usage in percentage (Percent Memory Used) of all Virtual machines.

1 Reply

@roopesh_shetty 

 

There is an example on the logs home page

Annotation 2019-06-06 195310.jpg

 

It does have CPU info as well, but if you edit that out you have:

 

// Memory usage
// Chart all computers' used memory  over the last hour
Perf
| where TimeGenerated > ago(1h)
| where  CounterName == "% Used Memory" 
| project TimeGenerated, CounterName, CounterValue 
| summarize avg(CounterValue) by CounterName, bin(TimeGenerated, 1m)
| render timechart

Note: you have to collect "% Used Memory"  in log Analytics https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-sources-performance-counters