[英]How do I fetch the hourly average CPUUtilization for my cluster?
I would like to be able to fetch the hourly average CPUUtilization for my cluster. 我希望能够获取群集的每小时平均CPUUtilization。 But using amazonica I get this error:
com.amazonaws.services.cloudwatch.model.InvalidParameterValueException: The parameter StartTime must not equal parameter EndTime.
但是使用
com.amazonaws.services.cloudwatch.model.InvalidParameterValueException: The parameter StartTime must not equal parameter EndTime.
出现以下错误: 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})
Running this aws cmd returns the correct metric, but I want to use amazonica to do this. 运行此aws cmd将返回正确的指标,但是我想使用amazononica来执行此操作。
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
Due to the documentation :start-time and :end-time must be a Date object. 由于文档的原因, :start-time和:end-time必须是Date对象。 It does not work with string in your example.
在您的示例中,它不适用于字符串。 You can also take a look at this example
您也可以看一下这个例子
(let [date-string (.. (SimpleDateFormat. "MM-dd-yyyy")
(format (Date.)))]
(get-metric-statistics
....
:start-time (.minusDays (DateTime.) 1)
:end-time date-string
...
))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.