cloudwatch命令get-metric-data

问题描述 投票:0回答:1

我无法通过此命令获取指标数据。

aws cloudwatch get-metric-data --metric-data-queries jsonfile.json \
   --start-time 2019-02-01T10:40:0000 --end-time 2019-02-27T14:12:0000 

显示以下错误。

Error parsing parameter '--metric-data-queries': Expected: '=', received: 'EOF' for input:

jsonfile.json

这里,jsonfile.json包含我的查询,定义如下。

[
    {
        "Id": "MyRequest",
        "MetricStat": {
            "Metric": {
                "Namespace": "AWS/EBS",
                "MetricName": "VolumeReadBytes",
                "Dimensions": [
                    {
                        "Name": "VolumeId",
                        "Value": "vol-******420********"
                    }
                ]
            },
            "Period": "3600",
            "Stat": "Average",
            "Unit": "Bytes"
        },
        "Label": "myRequestLabel",
        "ReturnData": "true"
    }
]
amazon-web-services amazon-ec2 amazon-cloudwatch amazon-ebs
1个回答
1
投票

我想你需要经营的是;

    aws cloudwatch get-metric-data --cli-input-json file://jsonfile.json

您的jsonfile.json的内容应如下所示;

    {
        "MetricDataQueries": [
            {
                "Id": "MyRequest",
                "MetricStat": {
                    "Metric": {
                        "Namespace": "AWS/EBS",
                        "MetricName": "VolumeReadBytes",
                        "Dimensions": [
                            {
                                "Name": "VolumeId",
                                "Value": "vol-******420********"
                            }
                        ]
                    },
                    "Period": "3600",
                    "Stat": "Average",
                    "Unit": "Bytes"
                },
                "Label": "myRequestLabel",
                "ReturnData": "true"
            }
        ],
        "StartTime": "2019-02-01T10:40:0000",
        "EndTime": "2019-02-27T14:12:0000"
    }
© www.soinside.com 2019 - 2024. All rights reserved.