I am writing KQL queries to setup alerting mechanism in our environment. However we got blocked for few alerts.
I need to get total used capacity of storage account in percentage, with below query I am able to get total used Capacity but not in percentage:
AzureMetrics
| where ResourceProvider == "MICROSOFT.STORAGE"
| where MetricName == "UsedCapacity"
I tried to reproduce the same in my environment and below is the result
need to get total used capacity of storage account in percentage, with below query i am able to get total used Capacity but not in percentage
You can use below KQL query to get the output in percentage.
AzureMetrics
| where ResourceProvider == "MICROSOFT.STORAGE"
| summarize Totalvalue = sum(Total) by MetricName| as T
| extend Percentage = round(100.0 * Totalvaule / toscalar(T | summarize sum(Totalvalue)), 2)
Output