使用 JMX 计算应用程序的内存消耗
我想编写一个内存监视和通知实用程序来监视 JVM 中的特定应用程序。需要明确的是,我对 JVM 内存消耗不感兴趣,而是想单独监视我的应用程序内存,并希望在内存超过特定级别时收到通知(通过电子邮件)。
我猜 MemoryMxBean 处理 JVM 内存。
任何想法将不胜感激。 谢谢。
I want to write a memory monitoring and notification utility that monitors specific application in JVM. To be clear I am not interested in JVM memory consumption rather I want to monitor my application memory alone, and want to get notified (by email) when ever the memory exceeds certain levels.
MemoryMxBean deals with JVM memory I guess.
Any thoughts would be appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 Sigar。它有一个基于 Java 的 API,用于收集有关本机操作系统内存使用情况以及各个进程的信息。创建一个使用 Sigar 公开此数据的 JMX MBean 将相当简单。
//尼古拉斯
Take a look at Sigar. It has a Java based API for gathering information about the native OS memory usage, as well as about individual processes. It will be fairly straight forward to create a JMX MBean that uses Sigar to expose this data.
//Nicholas