我希望能够获取我的集群的每小时平均CPUUtilization。但是使用amazononica时出现此错误:<html>
<head>
</head>
<body>
<svg id="svgOne" xmlns="http://www.w3.org/2000/svg" width="550" height="550">
</svg>
<script type="text/javascript">
var svgns = "http://www.w3.org/2000/svg";
function rectan()
{
for (var i = 0; i < 5; i++) {
var x = Math.floor(Math.random() * 200) + 1 ;
y = Math.floor(Math.random() * 200) + 1 ;
var rect = document.createElementNS(svgns, 'rect');
rect.setAttributeNS(null, 'x', x);
rect.setAttributeNS(null, 'y', y);
rect.setAttributeNS(null, 'height', '50');
rect.setAttributeNS(null, 'width', '50');
rect.setAttributeNS(null, 'fill', 'none');
rect.setAttributeNS(null, 'stroke', '#010101');
document.getElementById('svgOne').appendChild(rect);
}
}
rectan();
</script>
</body>
</html>
com.amazonaws.services.cloudwatch.model.InvalidParameterValueException: The parameter StartTime must not equal parameter EndTime.
运行此aws cmd返回正确的指标,但是我想使用amazononica来执行此操作。
(get-metric-statistics {:metric-name "CPUUtilization"
:namespace "AWS/ECS"
:dimensions [{:name "ClusterName" :value "my-cluster"}]
:start-time "2018-08-31T12:00:00Z"
:end-time "2018-08-31T13:00:00Z"
:statistics ["Average"]
:period 3600})
答案 0 :(得分:2)
由于documentation:开始时间和:结束时间必须是Date对象。在您的示例中,它不适用于字符串。您也可以看看这个example
(let [date-string (.. (SimpleDateFormat. "MM-dd-yyyy")
(format (Date.)))]
(get-metric-statistics
....
:start-time (.minusDays (DateTime.) 1)
:end-time date-string
...
))