Forum Discussion

roopesh_shetty's avatar
roopesh_shetty
Copper Contributor
Jun 06, 2019

Query for Percent Memory Used

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.

3 Replies

  • NDDev105's avatar
    NDDev105
    Copper Contributor
    roopesh_shetty, you can use:
    Perf
    | where ObjectName == "Memory" and CounterName == "% Committed Bytes In Use"
    | summarize AvgMemoryUsage = avg(CounterValue) by bin(TimeGenerated, 1hr), Computer
    | render timechart with (title = "Memory Utilization", xtitle = "Time", ytitle = "Value", ymax=100)
  • CliveWatson's avatar
    CliveWatson
    Silver Contributor

    roopesh_shetty 

     

    There is an example on the logs home page

     

    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

    • TadasJ1825's avatar
      TadasJ1825
      Copper Contributor

      CliveWatson From what I understand, this does not work for Windows VMs, since they do not have the "% Used Memory" performance counter.

Resources