如何通过内存监控EC2实例? [英] How to monitor EC2 instances by memory?

查看:54
本文介绍了如何通过内存监控EC2实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Cloudwatch,您可以通过多种标准来监控您的 EC2 实例,例如网络使用情况、CPU 使用情况等……

Using Cloudwatch you can monitor your EC2 instances by several criteria, such as network usage, CPU usage, and so on…

不幸的是,没有内存消耗指标.首先,只是出于好奇,我想知道,为什么?任何人都可以解释为什么可以,例如,监控 CPU 使用情况,而不是内存使用情况?至少对我来说,这并不明显.

Unfortunately, there is no metric for memory consumption. First of all, just out of curiosity, I would like to know, why? Can anybody explain why it is possible to, e.g., monitor CPU usage, but not memory usage? At least to me, that's not obvious.

然后,我的实际问题是:好的,鉴于 Cloudwatch 不允许监控 EC2 实例的内存使用情况 - 有什么替代方案?如果,例如,我应该如何设置警报> 实例的 80% 内存正在使用?

And then, my actual question: Okay, given that Cloudwatch doesn't allow monitoring the EC2 instances' memory usage - what is the alternative? How should I setup an alarm if, e.g. > 80% of the memory of an instance is being used?

推荐答案

特定于内存和磁盘的统计信息需要 AWS 在操作系统级别而不是主机级别进行监控,因此他们默认将其排除在外.它可能会在某个时候添加,但由于它已经在愿望清单上大约 7 年,我们可以假设它是一个非常低优先级的项目.

Memory and Disk specific statistics require AWS to monitor at the OS level rather than the host level, so that is why they leave it out by default. It will probably be added at some point but since it has been on the wish list for about 7 years, we can assume it's a very low priority item.

监控内存使用情况的推荐方法是通过在实例上使用您自己的监控脚本来创建自定义 Cloudwatch 指标.AWS 已已发布的文档介绍了如何在 Linux 上实现此目标具有一组(不受支持的)脚本的实例.

The recommended way to monitor memory usage is to create a custom Cloudwatch metric by using your own monitoring scripts on your instances. AWS have published documentation on how to achieve this on Linux instances with a set of (unsupported) scripts.

一旦您的实例发布自定义指标,您就可以在 CloudWatch 中为其附加警报.

Once your instances are publishing the custom metrics, you will be able to attach alarms to them in CloudWatch.

这篇关于如何通过内存监控EC2实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆