You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Azure VM磁盘剩余空间查询从Perf表迁移至InsightsMetrics表

适配InsightsMetrics表的磁盘剩余空间查询方案

你可以使用todynamic()函数将Tags字段从JSON字符串转换为动态类型,直接提取其中的mount属性作为盘符列,以下是和原有逻辑完全等效的查询:

// 提取剩余容量指标
InsightsMetrics
| where Namespace == "LogicalDisk"
| where Name == "Free Megabytes"
| extend Tags = todynamic(Tags)
| extend Drive = tostring(Tags.mount)
| where Drive != "_Total"
| where Drive !startswith "HarddiskVolume"
| summarize arg_max(TimeGenerated, *) by Drive, Computer
| project TimeGenerated, Computer, Drive, bin(FreeGB = Val / 1024, 0.1)
// 关联剩余百分比指标
| join kind=inner (
    InsightsMetrics
    | where Namespace == "LogicalDisk"
    | where Name == "% Free Space"
    | extend Tags = todynamic(Tags)
    | extend Drive = tostring(Tags.mount)
    | where Drive != "_Total"
    | where Drive !startswith "HarddiskVolume"
    | summarize arg_max(TimeGenerated, *) by Drive, Computer
    | project TimeGenerated, Computer, Drive, bin(FreePercent = Val, 1)
) on Computer, Drive
| project TimeGenerated, Computer, Drive, FreeGB, FreePercent
| order by Computer asc

该查询自动兼容Windows、Linux系统的磁盘指标采集,无需额外区分对象名差异,输出字段和原有查询完全一致,无需依赖Log Analytics代理额外采集性能计数器。


内容的提问来源于stack exchange,提问作者Manu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 23:09:01