监视 Azure VM 上的可用磁盘 space

Monitor free disk space on Azure VM

有什么方法可以从 Azure 门户监控空闲磁盘 space?

我知道有I/O、内存、网络、CPU、.NET、SQL、ASP.NET、IIS等各种诊断。

但是有什么方法可以查看附加到 VM 的磁盘上有多少空闲 space?

我只找到了这个第三方解决方案:

http://cloudmonix.com/blog/how-to-monitor-free-disk-space-on-azure-vms/

但是应该有一些方法可以在不需要第三方软件的情况下查看像磁盘这样的基本指标 space,对吗?

目前无法在 Azure 门户上实现。

但您可以通过使用 Azure OMS. There is a example 如何使用 Azure OMS 监控空闲磁盘来实现。

目前无法通过 Azure 门户或 Azure Monitor 实现。可用磁盘 space 是来宾 OS 性能计数器。如果这是 Windows VM,您可以使用 Windows Azure 诊断 (WAD) 代理将性能计数器收集到 Azure 存储 table and/or EventHub 并设置自定义工具以监控这些数据。如果这是 Linux 虚拟机,则还有等效的 Linux 诊断扩展。

以下是 WAD 上的一些相关链接 -

https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-extensions-diagnostics-template?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/azure-diagnostics-streaming-event-hubs

2019 年更新

今天这是可能的。要使用 Azure Monitor 监视每个驱动器的可用磁盘 space,请执行以下操作:

  1. Enable Guest Operating System OS Metrics for the VM.
  2. Azure 门户 select 虚拟机中。
  3. 单击诊断设置(在监控下)。
  4. 单击性能计数器 选项卡。
  5. 单击 自定义 按钮。
  6. 在文本框中为您想要的驱动器添加自定义指标。例如\LogicalDisk(C:)\% Free Space.
  7. 单击添加并将单位设置为Percent

来源:Azure 支持。


从 Linux 的 Azure Guest Monitor 查看日志:

// Virtual Machine free disk space
// Show the latest report of free disk space, per instance
InsightsMetrics
| where Name == "FreeSpacePercentage"
| summarize arg_max(TimeGenerated, *) by Tags
// arg_max over TimeGenerated returns the latest record
| project TimeGenerated, Computer, Val, Tags

这将导致以下警报查询(查询中需要 AggregatedValuebin(TimeGenerated, <some time>)):

InsightsMetrics
| where Name == "FreeSpacePercentage"
| summarize AggregatedValue=arg_min(Val, *)  by bin(TimeGenerated, 5min), Tags

查看任何通用诊断端点的相同内容(感谢@gabe):

打开此功能后,我可以通过日志查询查看可用磁盘 space:

// Virtual Machine free disk space 
// Show the latest report of free disk space, per instance 
Perf 
 | where ObjectName == "LogicalDisk" or 
// the object name used in Windows records 
  ObjectName == "Logical Disk" // the object name used in Linux records 
 | where CounterName == "Free Megabytes" 
 | summarize arg_max(TimeGenerated, *) by InstanceName 
// arg_max over TimeGenerated returns the latest record 
 | project TimeGenerated, InstanceName, CounterValue

这在 Azure 门户中是可能的。在 VM 资源页面 select 日志边栏选项卡中搜索“空闲磁盘”。您将获得一个默认查询,可以是 运行 获取磁盘使用情况。 您可以将此查询固定到仪表板或将其发送到工作簿以经常检查使用情况。

参考 - Microsoft Techcommunity