Query to get avg memory available in MB/GB

%3CLINGO-SUB%20id%3D%22lingo-sub-1322869%22%20slang%3D%22en-US%22%3EQuery%20to%20get%20avg%20memory%20available%20in%20MB%2FGB%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1322869%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%20i%20have%20a%20query%20in%20azure%20analytics%20to%20get%20avg%20memory%20available%20in%20bytes..how%20can%20i%20change%20it%20to%20MB%20or%20GB%3F%20here%20is%20the%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20Average%20available%20memory%20in%20bytes%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start%3D%3C%2FSPAN%3E%3CSPAN%3Edatetime%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%222020-04-20T18%3A58%3A00.000Z%22%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20end%3D%3C%2FSPAN%3E%3CSPAN%3Edatetime%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%222020-04-20T20%3A15%3A00.000Z%22%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20timeGrain%3D%3C%2FSPAN%3E%3CSPAN%3E1%3C%2FSPAN%3E%3CSPAN%3Em%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EperformanceCounters%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26lt%3B%20end%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Available%20Bytes%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20additional%20filters%20can%20be%20applied%20here%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20avg(value)%20%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20bin(timestamp%2C%20timeGrain)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20render%20result%20in%20a%20chart%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Erender%3C%2FSPAN%3E%3CSPAN%3E%20timechart%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1322869%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-1323698%22%20slang%3D%22en-US%22%3ERe%3A%20Query%20to%20get%20avg%20memory%20available%20in%20MB%2FGB%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1323698%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F629928%22%20target%3D%22_blank%22%3E%40Kanuri15%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsing%20the%20demo%20data%2C%20adjust%20into%20your%20own%20query%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-cpp%22%3E%3CCODE%3E%2F%2F%20Average%20available%20memory%20in%20bytes%0APerf%0A%7C%20where%20CounterName%20%3D%3D%20%22Bytes%20Total%2Fsec%22%0A%2F%2F%20additional%20filters%20can%20be%20applied%20here%0A%7C%20summarize%20Bytes%3Davg(CounterValue)%2C%20KBytes%20%3Davg(CounterValue)%2F(1024)%2C%20Mbytes%3D%20avg(CounterValue)%2F(1024*1024)%20by%20bin(TimeGenerated%2C%201h)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fms.portal.azure.com%23%4072f988bf-86f1-41af-91ab-2d7cd011db47%2Fblade%2FMicrosoft_Azure_Monitoring_Logs%2FDemoLogsBlade%2FresourceId%2F%252FDemo%2Fsource%2FLogsBlade.AnalyticsShareLinkToQuery%2Fq%2FH4sIAAAAAAAAA3WPsYrCQBRF%25252B0D%25252B4WIVRRiVbVPoFluIYiHbv5irPpiZyGQSUfz4ncTtlq3f4Zx3jcG6Z5ALIb2olcoSjq4JD6hH9Yhs8%25252BzAcM6zF%25252B5XBuKz6Xxk2IsjyhKTzQDh2ESxpuVpkmfGQOpaozZeLM5qE97iJEmYOrebVdYYXIO07ZyToE9iFJXSX4rfxLfYjtM5tu%25252FE35MplovVRyJ246cl%25252FiFmI5bmoFJfHNXxiz7NjqznWF6nP7sCZyAHAQAA%2Ftimespan%2FP1D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EGo%20to%20Log%20Analytics%20and%20run%20query%26nbsp%3B%26nbsp%3B%3C%2FA%3E%3CBR%20%2F%3Eexample%20result%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20cellspacing%3D%221%22%20cellpadding%3D%225%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTH%3ETimeGenerated%3C%2FTH%3E%0A%3CTH%3EBytes%3C%2FTH%3E%0A%3CTH%3EKBytes%3C%2FTH%3E%0A%3CTH%3EMbytes%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E2020-04-21T06%3A00%3A00Z%3C%2FTD%3E%0A%3CTD%3E1573.1209590028427%3C%2FTD%3E%0A%3CTD%3E1.5362509365262136%3C%2FTD%3E%0A%3CTD%3E0.0015002450552013805%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E2020-04-20T09%3A00%3A00Z%3C%2FTD%3E%0A%3CTD%3E4046.5230576107233%3C%2FTD%3E%0A%3CTD%3E3.951682673447972%3C%2FTD%3E%0A%3CTD%3E0.003859065110789035%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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