英文:
KQL queries to get total storage account used space in percentage
问题
我正在编写KQL查询以设置我们环境中的警报机制。但是,我们在一些警报上遇到了问题。
我需要以百分比的方式获取存储帐户的总使用容量,使用以下查询我能够获取总使用容量,但不是以百分比的方式:
AzureMetrics
| where ResourceProvider == "MICROSOFT.STORAGE"
| where MetricName == "UsedCapacity"
英文:
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"
答案1
得分: 0
我尝试在我的环境中复制相同的操作,以下是结果
> 需要以百分比形式获取存储帐户的总已使用容量,使用以下查询,我能够获取总已使用容量,但不是以百分比形式
您可以使用以下 KQL 查询以百分比形式获取输出。
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)
输出
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论