Error in getting Percentage value using KQL

Occasional Visitor

 

 

 

 

I am trying to use below query to find memory utilisation percentage, when i am trying to use summarize operator with division operator to get percentage its giving me output as zero only.

 

Can someone help please

 

InsightsMetrics
| where TimeGenerated > ago(1h)
| where Namespace contains "Memory"
| where Name contains "AvailableMB"
| extend FreeMB = toint(32000-toint(Val))
| extend totalMB = toint(Val) + toint(FreeMB)
| summarize percent = max((FreeMB/totalMB)*100) by bin(TimeGenerated, 5m)
1 Reply

@Azure_Kush2001 

 

Please try this (I have also replaced contains with has - as per best practise, also you can remove the two extra columns I added if its working ok?)

 

InsightsMetrics
| where TimeGenerated > ago(1h)
| where Namespace has "Memory"
| where Name has "AvailableMB"
| extend FreeMB = toreal(32000-toint(Val))
| extend totalMB = toreal(Val) + toint(FreeMB)
| summarize percent = max(FreeMB/totalMB)*100, max(FreeMB), max(totalMB) by bin(TimeGenerated, 5m)