【问题标题】:AWS Powershell - Get-CWMetricStatistics for EBS Read IOPSAWS Powershell - 获取 EBS 读取 IOPS 的 CWMetricStatistics
【发布时间】:2019-04-09 15:38:02
【问题描述】:

我在获取 EBS 卷的 IOP 统计信息时遇到了一些问题,使用以下代码:

Get-CWMetricList -Namespace AWS/EC2 |Select-Object * -Unique

Get-CWMetricList -Namespace AWS/EBS |Select-Object * -Unique

$StartDate = (Get-Date).AddDays(-3)
$EndDate = Get-Date
$ReadIOPS = Get-CWMetricStatistics -Namespace "AWS/EC2" -MetricName "DiskReadOps" -UtcStartTime $StartDate -UtcEndTime $EndDate -Period 300 -Statistics @("Average") 
$ReadIOPS.Datapoints.Count  
$ReadIOPS = Get-CWMetricStatistics  -Namespace "AWS/EBS" -MetricName "VolumeReadOps" -UTCStartTime $StartDate -UTCEndTime $EndDate -Period 300  -Statistics @("Average")
$ReadIOPS.Datapoints.Count

前 2 行显示命名空间/指标名称是正确的。 Rest 应该显示 AWS/EC2 命名空间中的第一个查询获取数据,但 AWS/EBS 命名空间中的第二个查询没有。

最终目标是添加一个 -dimension 标签并获取特定卷的所有读/写 iops。这就是 AWS/EC2 命名空间不起作用的原因,因为我需要指定卷 ID 而不是实例 ID。

任何想法为什么我没有在后一个查询中获取任何数据点?

【问题讨论】:

    标签: amazon-web-services powershell aws-powershell


    【解决方案1】:

    事实证明,EBS 统计数据需要指定一个 Vol ID,尽管这没有被调用或错误本身。

    在进行故障排除时,我已经剥离了维度以尽可能广泛地撒网/回归基础。添加回来解决了这个问题:

    即。这行得通

    $Volume = 'vol-blah'
    $dimension1 = New-Object Amazon.CloudWatch.Model.Dimension
    $dimension1.set_Name("VolumeId")
    $dimension1.set_Value($Volume)
    $ReadIOPS = Get-CWMetricStatistics -Namespace "AWS/EBS" -MetricName "VolumeReadOps" -UTCStartTime $StartDate -UTCEndTime $EndDate -Period 300  -Statistics @("Average") -Dimension $dimension1
    $ReadIOPS.Datapoints.Count
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-03
      • 2016-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多