使用JSON结构创建Cloudwatch仪表板时,“最新值”和“时间范围值”的等效项是什么

时间:2019-05-11 12:47:27

标签: amazon-cloudwatch amazon-cloudwatch-metrics

给出此cloudwatch仪表板json片段:

import numpy as np
A = np.matrix([[1, 2, 3], 
               [4, 5, 6], 
               [7, 8, 9],
               [10, 11, 12]])
u, s, vt = np.linalg.svd(A, full_matrices=False)
print(np.dot(u, np.dot(np.diag(s), vt)))

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

enter image description here

1 个答案:

答案 0 :(得分:1)

将此添加到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
  }
}