【问题标题】:Automate the VM/Server resources alerts hosted on Azure cloud自动化托管在 Azure 云上的 VM/服务器资源警报
【发布时间】:2017-09-28 06:13:32
【问题描述】:

是否有任何脚本可以自动化托管在 Azure 云上的 VM/服务器资源警报,例如 CPU、内存、磁盘空间利用率等。就像一个可以提供所有这些细节的 powershell 脚本? 任何帮助将不胜感激..

【问题讨论】:

  • 您的意思是要使用 PowerShell 脚本来监控它吗? Azure metric alerts 怎么样?
  • 是的,我需要一个 powershell 脚本来监控/获取指标值..

标签: powershell azure


【解决方案1】:

根据你的描述,也许我们可以使用这个命令Get-AzureRmMetric来获取度量值。

我们可以使用这个脚本来获取指标:

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

这是我的 PowerShell 输出:

以下是 Azure VM 的指标:

PS D:\testdata> (Get-AzureRmMetricDefinition -ResourceId $id).name

Value                     LocalizedValue
-----                     --------------
Percentage CPU            Percentage CPU
Network In                Network In
Network Out               Network Out
Disk Read Bytes           Disk Read Bytes
Disk Write Bytes          Disk Write Bytes
Disk Read Operations/Sec  Disk Read Operations/Sec
Disk Write Operations/Sec Disk Write Operations/Sec
CPU Credits Remaining     CPU Credits Remaining
CPU Credits Consumed      CPU Credits Consumed

如果您的 Azure PowerShell 版本是 3.4.0,我们可以使用 Powershell 获取其他指标,例如 \Memory\Committed Bytes

关于它的更多信息,请参考这个answer

【讨论】:

  • 感谢 Jason 的快速回复,这正是我所需要的……希望这能奏效……!如果我需要任何东西,我会回复你……
  • @avinashmitta 这对你有用吗?如果您需要更多帮助,请告诉我:)
猜你喜欢
  • 1970-01-01
  • 2016-01-22
  • 1970-01-01
  • 2013-05-15
  • 2016-07-25
  • 2016-09-07
  • 2014-04-17
  • 2019-11-06
  • 2015-10-28
相关资源
最近更新 更多