我无法通过此命令获取指标数据。
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"
}
]
最佳答案
我认为您需要运行;
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"
}