监控Azure VM上的可用磁盘空间

Tom*_*rek 10 virtual-machine azure azure-diagnostics azureportal

有没有办法从Azure门户监控可用磁盘空间?

我知道I/O,内存,网络,CPU,.NET,SQL,ASP.NET,IIS等都有各种诊断方法.

但有没有办法看到连接到VM的磁盘上有多少可用空间?

我发现的只是第三方解决方案:

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

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

Han*_*onn 15

2019 年更新

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

  1. 为 VM 启用来宾操作系统操作系统指标
  2. Azure 门户中选择虚拟机。
  3. 单击诊断设置(在监控下)。
  4. 单击性能计数器选项卡。
  5. 单击自定义按钮。
  6. 在文本框中为您想要的驱动器添加自定义指标。例如\LogicalDisk(C:)\% Free Space
  7. 单击添加并将单位设置为Percent

来源:Azure 支持。


从适用于 Linux 的 Azure 来宾监视器查看日志:

// 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
Run Code Online (Sandbox Code Playgroud)

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

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

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

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

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

  • 打开此功能后,我能够通过日志查询查看可用磁盘空间:`//虚拟机可用磁盘空间//显示每个实例的可用磁盘空间的最新报告Perf | 其中 ObjectName == "LogicalDisk" 或 // Windows 记录中使用的对象名称 ObjectName == "Logical Disk" // Linux 记录中使用的对象名称 | 其中 CounterName ==“可用兆字节”| Summary arg_max(TimeGeneerated, *) by InstanceName // arg_max over TimeGeneerated 返回最新记录 | 项目时间生成,实例名称,计数器值` (2认同)