Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
您可以选择将监控委托给专用工具,例如 Cacti、Centreon,或 Zenoss 但对于单个应用程序来说这可能有点过大了。
对于简单的解决方案,JMX 确实可能是更好的解决方案。作为起点,我建议阅读以下文章: 监控本地和使用 JMX 1.2 和 JConsole 的远程应用程序。然后,看看使用 JConsole 监控应用程序,这是一个非常详细的文章展示了如何使用 JConsole 访问多个核心监控和
Java平台提供的管理功能包括:
但是,据我所知,JMX 不会为您提供访问权限网络 IO,因此您可能需要这些工具的组合。幸运的是,许多工具(例如 Cacti、SmokePing)都使用 RDD 格式,您可以使用 Java 轻松操作该格式API,如
JRobin或 rdd4j。You could choose to delegate the monitoring to a dedicated tool like Cacti, Centreon, or Zenoss but this might be a bit overkill for a single application.
For a simple solution, JMX might indeed be a better solution. As starting point, I suggest reading the following article: Monitoring Local and Remote Applications Using JMX 1.2 and JConsole. Then, have a look at Using JConsole to Monitor Applications, a very detailed article that shows how to use JConsole to access several core monitoring and
management functionalities provided by the Java platform including:
But, AFAIK, JMX won't give you access to network IO so you might need a combination of these tools. Luckily, many tools (e.g. Cacti, SmokePing) use the RDD format that you can easily manipulate with Java APIs like
JRobinor rdd4j.我越来越喜欢 collectd,这是一个模块化的 C 守护进程,专注于通过大量 插件:
似乎有几个选项可以将指标纳入 Java 代码:
I'm growing fond of collectd, a modular C daemon focusing on monitoring (rather than graphing) with a multitude of plugins:
There would seem to be several options for getting metrics into your Java code:
只是想将 RHQ (http://rhq-project.org/) 加入其中:-)
Just want to throw RHQ (http://rhq-project.org/ ) in the mix :-)
您可以考虑使用 Ganglia 监控工具。它使用 XML 进行数据表示,因此我想从 Java 访问数据会相当简单,而且它还有一个额外的优点,那就是它被设计为高度可扩展的,有可能记录大量的服务器指标。机器。
You could look into using the Ganglia monitoring tool. It uses XML for its data representation and so I imagine it would be fairly straightforward to access the data from Java, and there are the added advantages that it's been designed to be highly scaleable, with the potential to record server metrics across a large number of machines.
您最好的选择可能是在 /proc 中查找所有系统资源使用情况 /proc/cpuinfo 和 /proc/net/ 是一个很好的起点。
Your best bet would probably look in /proc for all your systems resource usage /proc/cpuinfo and /proc/net/ are a good place to start.
Runtime.exec(“某个命令”)有什么问题?
What's wrong with Runtime.exec("some command")?
我不确定这是否有助于您的查询。恕我直言,Cacti 和 Centreon 似乎太复杂,无法投入时间来满足像您这样简单的需求。
有一些更简单的服务器监控工具,例如 New Relic 和 海狮。海狮是我目前最喜欢的。它提供了简单的默认命令,涵盖了最基本的要求(也可能涵盖您的要求)。它的设置也非常简单并且免费。你可以尝试一下这些。
I am not sure if this would assist in your query. IMHO Cacti and Centreon seem to be too complex to invest time into for a requirement as simple as yours.
There are simpler tools out there for server monitoring such as New Relic and SeaLion. SeaLion is the my current favourite. It gives simple default commands which cover most basic requirements (will probably cover yours as well). It's also extremely simple to setup and is free. You could try these out.