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

查看:395
本文介绍了如何通过内存监视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天全站免登陆