监视Azure VM上的可用磁盘空间 [英] Monitor free disk space on Azure VM

查看:70
本文介绍了监视Azure VM上的可用磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以监视Azure门户中的可用磁盘空间吗?

Is there some way how to monitor free disk space from the Azure Portal?

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

I know that there are all kinds of diagnostics for I/O, memory, network, CPU, .NET, SQL, ASP.NET, IIS, etc.

但是有什么方法可以查看连接到VM的磁盘上有多少可用空间?

But is there some way to see how much free space there's on a disk attached to the VM?

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

All I found was this third-party solution:

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

但是应该有某种方法可以在不需要第三方软件的情况下查看磁盘空间等基本指标,对吗?

But there should be some way how to see a basic metric like disk space without needing third-party SW, right?

推荐答案

更新2019

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

This is possible today. To monitor free disk space per drive with Azure Monitor do the following:

  1. 为VM启用客户操作系统的操作系统指标.
  2. Azure门户网站中选择虚拟机.
  3. 点击诊断设置(在监视"下).
  4. 点击性能计数器标签.
  5. 点击自定义按钮.
  6. 在文本框中,添加所需驱动器的自定义指标.例如 \ LogicalDisk(C:)\%可用空间.
  7. 点击添加,然后将单位设置为百分比.
  1. Enable Guest Operating System OS Metrics for the VM.
  2. In the Azure Portal select the Virtual Machine.
  3. Click Diagnostics Settings (under Monitoring).
  4. Click the Performance counters tab.
  5. Click the Custom button.
  6. In the textbox add the custom metric for the drive you would like. e.g. \LogicalDisk(C:)\% Free Space.
  7. Click Add and set the Unit to Percent.

来源:Azure支持.

Source: Azure Support.

要从适用于Linux的Azure Guest Monitor中查看日志,请执行以下操作:

To view the logs from the Azure Guest Monitor for Linux:

// 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

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

This results in the following alert query (you need AggregatedValue and bin(TimeGenerated, <some time>) in the query):

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


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


To view the same for any generic diagnostics endpoint (thanks @gabe):

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

After turning this on, i was able to view the free disk space with a log query:

// 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上的可用磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆