我想自动获取Cloudwatch屏幕快照,因为我有很多实例。
但是,当我尝试通过aws cli命令工具运行get-metric-widget-image时,总是会出错。
调用GetMetricWidgetImage操作时发生错误(ValidationError):MetricWidget属性'metricWidget'具有错误的JSON内容。
有谁可以帮助我吗?谢谢。
我无法从AWS文档中找到示例。下面的链接中没有确切的例子。 https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Metric-Widget-Structure.html
我的命令是这样的。
aws cloudwatch get-metric-widget-image --metric-widget "{ "width":600,"height":395,"metrics":[["AWS/EC2","CPUUtilization","InstanceId","i-01234567890123456",{"stat":"Average"}]],"period":300,"start":"-P30D","end":"PT0H","stacked":false,"yAxis":{"left":{"min":0.1,"max":1},"right":{"min":0}},"title":"CPU","annotations":{"horizontal":[{"color":"#ff6961","label":"Troublethresholdstart","fill":"above","value":0.5}], "vertical":[{"visible":true, "color":"#9467bd","label":"Bugfixdeployed","value":"2018-11-19T07:25:26Z","fill":"after"}]}}}" --output-format "png"
Run Code Online (Sandbox Code Playgroud)