amazon-web-servicesmetricsamazon-cloudwatchcloudwatch

Aws cloudwatch get.metrics with more than one dimension


I'm trying to use the command aws cloudwatch get-metrics to obtain "DiskSpaceUtilization" but the result is empty..

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

I noticed that if I use

aws cloudwatch list-metrics --namespace mymetric

the metric has more than one dimensions!

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

Someone knows how can I retrieve this metric? How many dimensions I have to put in the command?

Thanks!


Solution

  • Finally I found the solution..

    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