AWS cloudwatch get.metrics 具有不止一维

Aws cloudwatch get.metrics with more than one dimension

我正在尝试使用命令 aws cloudwatch get-metrics 获取 "DiskSpaceUtilization" 但结果为空..

"Datapoints": [],
"Label": "DiskSpaceUtilization"

我注意到如果我使用

aws cloudwatch list-metrics --namespace mymetric

指标有多个维度!

        "Namespace": "mymetric",
        "Dimensions": [
            {
                "Name": "MountPath",
                "Value": "/"
            },
            {
                "Name": "InstanceId",
                "Value": "i-aaaaaaa"
            },
            {
                "Name": "Filesystem",
                "Value": "/dev/xvda1"
            }
        ],
        "MetricName": "DiskSpaceUtilization"

有人知道如何检索此指标吗?我必须在命令中输入多少个维度?

谢谢!

终于找到解决方法了..

aws cloudwatch get-metric-statistics --namespace MyCustomMetric --metric-name DiskSpaceUtilization --dimensions Name="MountPath",Value="/dev" Name="InstanceId",Value="i-XXXXX" Name="Filesystem",Value="devtmpfs" --start-time 2016-12-23T7:10 --end-time 2016-12-23T7:20 --period 600 --statistic Average