我下载了命令行工具CloudWatch-2010-08-01.zip(据我所知,最新版本)。根据{{3}},我应该可以一次发送多个统计信息:
-m, --metric-name VALUE1,VALUE2,VALUE3...
The name of the Metric to be gathered. Required.
但我的mon-put-data副本告诉我,我一次只能发送一个 - 这是来自打印出来的使用信息:
-m, --metric-name VALUE
The name of the Metric to be gathered. Required.
我搞砸了什么东西,或亚马逊是否让他们的版本混淆了?
答案 0 :(得分:0)
这是一次一个,因为这就是Web服务API支持的内容。
最新版本的CLI工具实际上是AWS Unified CLI Tools。它使用Web服务API以1:1映射,因此应该更清楚如何使用它。自动完成功能也很方便。
如果您还安装了推荐的jq CLI工具,则可以执行以下操作:
prompt > aws cloudwatch list-metrics | jq ".Metrics[].MetricName" | sort | uniq "CPUUtilization" "DatabaseConnections" "DiskQueueDepth" "DiskReadBytes" "DiskReadOps" "DiskWriteBytes" "DiskWriteOps" "FreeStorageSpace" "FreeableMemory" "HTTPCode_Backend_2XX" "HTTPCode_Backend_3XX" "HTTPCode_Backend_4XX" "HTTPCode_Backend_5XX" "HealthyHostCount" "Latency" "NetworkIn" "NetworkOut" "NumberOfMessagesPublished" "NumberOfNotificationsDelivered" "NumberOfNotificationsFailed" "ProvisionedReadCapacityUnits" "ProvisionedWriteCapacityUnits" "PublishSize" "ReadIOPS" "ReadLatency" "ReadThroughput" "RequestCount" "StatusCheckFailed" "StatusCheckFailed_Instance" "StatusCheckFailed_System" "SwapUsage" "UnHealthyHostCount" "VolumeIdleTime" "VolumeQueueLength" "VolumeReadBytes" "VolumeReadOps" "VolumeTotalReadTime" "VolumeTotalWriteTime" "VolumeWriteBytes" "VolumeWriteOps" "WriteIOPS" "WriteLatency" "WriteThroughput" prompt >
从那里,您可以查看GetMetricStatistics的API参考,并将此查询放在一起:
aws cloudwatch get-metric-statistics \
--metric-name CPUUtilization \
--statistics Average \
--namespace AWS \
--period 600 \
--start-time 20130320 \
--end-time 20130323