如何从 Azure 指标中获取 "Network In" 和 "Network Out"?

How to get "Network In" and "Network Out" from Azure metrics?

我在 Azure VM 中有一个虚拟机,我想获得 Network-In/Network-Out 指标。
在 Azure 门户中,我将诊断设置和指标存储到 selected 存储 table 中。但存储的指标与我在 Azure 门户中看到的指标之间存在一些差异。 在 Azure 门户中,我可以从指标列表中 select Network InNetwork Out(请参见下面的屏幕截图): 如您所见,此处的指标名称为 Network InNetwork Out,它显示了 VM 网络的使用情况。
但是在存储 table 中,它显示了不同的指标列表并且它是聚合的。下面列出了 CounterName 存储 table 中保存的指标:

我在想 \NetworkInterface\BytesReceived\NetworkInterface\BytesTransmittedNetwork InNetwork Out 相同。但它是聚合的,不是每分钟传输的字节。它会在当前分钟之前聚合到所有其他指标。请看下面的截图: 那么问题是我应该如何获得 Network InNetwork Out 指标?

根据您的描述,也许您可​​以使用 Azure PowerShell 命令来获取:

Get-AzureRmMetric -ResourceId $id -TimeGrain 00:01:00 -DetailedOutput -MetricNames "Network in"

这样的输出:

有关 Azure VM 支持指标的更多信息,请参阅 to this link

这里有一个关于你的类似案例,