Aws cloudwatch具有多个维度的get.metrics

时间:2017-01-10 16:50:31

标签: amazon-web-services metrics amazon-cloudwatch cloudwatch

我正在尝试使用命令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"

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

谢谢!

1 个答案:

答案 0 :(得分:1)

最后我找到了解决方案..

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