简体   繁体   English

是否可以使用AWS api创建Cloudwatch图表?

[英]Is it possible to use the AWS api to create Cloudwatch graphs?

Is it possible to create graphs programmatically in a Cloudwatch dashboard using the AWS API or a SDK? 是否可以使用AWS API或SDK在Cloudwatch仪表板中以编程方式创建图形?

Edit I'd like to use the API to create Metric and Text widgets in the Cloudwatch Dashboard. 编辑我想使用API​​在Cloudwatch仪表板中创建Metric和Text小部件。 I do not want to manually create each graph. 我不想手动创建每个图表。

This answer is now out of date, please see the other answer about using CloudFormation to codify CloudWatch Dashboards. 此答案现已过时,请参阅有关使用CloudFormation编写CloudWatch Dashboards的其他答案。 For historical purposes here is my original reply: The accepted answer is effectively "no". 出于历史目的,这是我原来的答复:接受的答案实际上是“不”。 However it may be worth noting that if you were to create a graph through the web interface and inspect the URL that is generated for you through the "Copy URL" button, you can see the patterns it uses and you could come up with your own URL. 但是,值得注意的是,如果您要通过Web界面创建图形并通过“复制URL”按钮检查为您生成的URL,您可以看到它使用的模式,您可以想出自己的模式URL。 Note that when you click the "Copy URL" button in the CloudWatch web interface, it doesn't do anything special on its backend other than programmatically generate a URL for you based on your currently selected options. 请注意,当您单击CloudWatch Web界面中的“复制URL”按钮时,除了根据您当前选择的选项以编程方式为您生成URL之外,它在其后端不会执行任何特殊操作。 Therefore in a way this offers you a way to generate your own graphs programmatically, albeit in a rather unintuitive and messy way since as far as I can tell there isn't a published specification for how those URLs are assembled and you must figure it out on your own through trial and error. 因此,在某种程度上,这为您提供了一种以编程方式生成自己的图形的方法,虽然它是一种相当不直观和混乱的方式,因为据我所知,没有已发布的规范来说明这些URL是如何组合的,您必须弄明白通过反复试验自己。

I contacted AWS technical support. 我联系了AWS技术支持。 This is a snippet of the response: 这是响应的片段:

Unfortunately, this is not possible at the moment... I went ahead and created a feature request to our CloudWatch team... 不幸的是,目前这是不可能的......我继续为CloudWatch团队创建了一个功能请求......

The answer is "No", this is not possible at this time. 答案是“否”,目前这是不可能的。

The short answer is yes. 简短的回答是肯定的。 CloudWatch has support for Custom Metrics data ie either application specific data which you can evaluate and send to CloudWatch or real-time data like [to use example stated by Amazon] Temperature of your data center. CloudWatch支持自定义度量标准数据,即您可以评估并发送到CloudWatch的应用程序特定数据,或者[使用亚马逊规定的示例]数据中心温度等实时数据。

You can use CloudWatch to represent any data, to simplify CloudWatch is just a Statistics Repository which would keep your data for 14 days. 您可以使用CloudWatch来表示任何数据,以简化CloudWatch只是一个统计信息库,可以将您的数据保存14天。

Once you upload your data, they would appear as custom metrics in the CloudWatch Page. 上传数据后,它们将在CloudWatch页面中显示为自定义指标。 You can navigate and use the provided custom metric to represent your data in the CloudWatch Dashboard. 您可以导航并使用提供的自定义指标在CloudWatch控制面板中表示您的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM