我希望能够获取我的集群的每小时平均CPUUtilization。但是在使用amazonica时,我得到了这个错误:com.amazonaws.services.cloudwatch.model.InvalidParameterValueException: The parameter StartTime must not equal parameter EndTime.
(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})运行此aws cmd将返回正确的指标,但我想使用amazonica来完成此操作。
aws cloudwatch 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发布于 2018-08-31 22:57:48
由于documentation :start-time和:end-time必须是Date对象。在您的示例中,它不能与字符串一起使用。您还可以查看此example
(let [date-string (.. (SimpleDateFormat. "MM-dd-yyyy")
(format (Date.)))]
(get-metric-statistics
....
:start-time (.minusDays (DateTime.) 1)
:end-time date-string
...
))https://stackoverflow.com/questions/52116193
复制相似问题