1

鉴于此 cloudwatch 仪表板 json 片段:

{
  "type": "metric",
  "x": 3,
  "y": 0,
  "width": 3,
  "height": 3,
  "properties": {
    "metrics": [
      [
        "AWS/ApiGateway",
        "Count",
        "ApiName",
        "my-api",
        {
          "stat": "Sum"
        }
      ]
    ],
    "view": "singleValue",
    "region": "eu-west-1",
    "period": 300,
    "title": "Number of api calls"
  }
}

小部件默认显示“最新值”。根据下面的屏幕截图,我想查看“时间范围值”。如何使用 cloudwatch 仪表板 json 指定该设置?

在此处输入图像描述

4

1 回答 1

3

将此添加到properties对象:

"setPeriodToTimeRange": true

在您的示例中:

{
  "type": "metric",
  "x": 3,
  "y": 0,
  "width": 3,
  "height": 3,
  "properties": {
    "metrics": [
      [
        "AWS/ApiGateway",
        "Count",
        "ApiName",
        "my-api",
        {
          "stat": "Sum"
        }
      ]
    ],
    "view": "singleValue",
    "region": "eu-west-1",
    "period": 300,
    "title": "Number of api calls",
    "setPeriodToTimeRange": true
  }
}
于 2019-05-11T19:01:03.620 回答