Forum Discussion

Kanuri15's avatar
Kanuri15
Copper Contributor
Apr 20, 2020

Query to get avg memory available in MB/GB

Hi All, i have a query in azure analytics to get avg memory available in bytes..how can i change it to MB or GB? here is the query.

 

// Average available memory in bytes
let start=datetime("2020-04-20T18:58:00.000Z");
let end=datetime("2020-04-20T20:15:00.000Z");
let timeGrain=1m;
performanceCounters
| where timestamp > start and timestamp < end
| where name == "Available Bytes"
// additional filters can be applied here
| summarize avg(value) by bin(timestamp, timeGrain)
// render result in a chart
| render timechart

1 Reply

  • Kanuri15 

     

    Using the demo data, adjust into your own query:

    // Average available memory in bytes
    Perf
    | where CounterName == "Bytes Total/sec"
    // additional filters can be applied here
    | summarize Bytes=avg(CounterValue), KBytes =avg(CounterValue)/(1024), Mbytes= avg(CounterValue)/(1024*1024) by bin(TimeGenerated, 1h)

     

    Go to Log Analytics and run query  
    example result:

     

    TimeGenerated Bytes KBytes Mbytes
    2020-04-21T06:00:00Z 1573.1209590028427 1.5362509365262136 0.0015002450552013805
    2020-04-20T09:00:00Z 4046.5230576107233 3.951682673447972 0.003859065110789035

     

Resources