使用Java进行简单服务器监视 [英] Simple Server Monitoring with Java

查看:144
本文介绍了使用Java进行简单服务器监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种解决方案,以允许我监视服务器的资源消耗.最好,我要获取的指标是网络利用率IO,以及CPU利用率/平均负载和磁盘IO(如果可能).

I'm trying to find a solution that allows me to monitor resource consumption of a server. Preferably, the metrics I'm wanting to obtain are network utilisation IO, and if possible CPU usage/load average and disk IO.

我唯一的其他要求是该信息可由Java获得,因此可以对其进行操作,并且至少可以在Linux(Fedora)上运行.

The only other requirement I have is that this information be obtainable by Java so it can be manipulated, and at least work on Linux (Fedora).

我听说过一些监视工具,但是我不确定执行此操作的最佳方法.我可能希望每30秒收集一次信息.

I've heard about a few monitoring tools but I'm just not sure of the best way of going about this. I would probably want to be gathering the information about every 30 seconds.

谢谢

更新:重申一下,我指的是系统范围的监视,而不是Java特定的监视.我只想使用Java来访问这些指标

推荐答案

您可以选择将监视委托给专用工具,例如中心

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.

对于一个简单的解决方案,JMX确实可能是一个更好的解决方案.首先,我建议阅读以下文章:监视本地和使用JMX 1.2和JConsole的远程应用程序.然后,看看使用JConsole监视应用程序,详细的文章显示如何使用JConsole来访问几个核心监视和 Java平台提供的管理功能,包括:

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:

  • 检测内存不足
  • 启用或禁用GC和类加载详细跟踪
  • 检测死锁
  • 控制应用程序中任何记录器的日志级别
  • 访问OS资源-Sun的平台扩展
  • 管理应用程序的托管Bean(MBean)
  • Detect low memory
  • Enable or disable GC and class loading verbose tracing
  • Detect deadlocks
  • Control the log level of any loggers in an application
  • Access OS resources—Sun's platform extension
  • Manage an application's Managed Beans (MBeans)

但是,AFAIK,JMX无法让您访问网络IO,因此您可能需要这些工具的组合.幸运的是,许多工具(例如Cacti, SmokePing )使用的RDD格式可以通过Java轻松操作诸如 JRobin

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 JRobin or rdd4j.

这篇关于使用Java进行简单服务器监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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