使用JMX监控Tomcat服务器的简单工具 [英] Simple tool to monitor a Tomcat server using JMX

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

问题描述

我是一名计算机科学学生,目前正在做实习。我的老板要我写一个简单的工具来监控一个Tomcat服务器。我只是开始这个​​项目,所以我基本上只是玩弄看看事情如何工作。我想创建一个简单的jsp页面,显示一些基本的JMX查询的结果。我正在使用Eclipse IDE。有人可以给我一些开始的提示吗?

解决方案

你绝对不必重新发明轮子,在这里。您可以从您的JDK附带的 jconsole 开始:只需运行 jconsole [pid] jconsole 将连接到(本地)运行的进程,让您通过JMX观察所有内容。



如果要远程访问JMX暴露信息,您可以使用Tomcat的管理器 webapp以及包含的 jmxproxy servlet,允许您远程执行简单查询以获取(和设置)JMX属性。



还有其他更加功能齐全的项目,如Jolokia( http://www.jolokia.org/ )做类似的事情。



假设你正在使用类似的东西Nagios自动观察你的Tomcat实例,你绝对不想做一个JVM,并建立一个远程(甚至本地)JMX连接来检查一个JMX属性(然后再做5次观察5)不同的属性,然后做t软管5个样品每5分钟,或1分钟,或任何)。相反,您可能希望使用如上所述的代理。



我们已经将Nagios与Tomcat经理的 jmxproxy servlet。很可能会满足您的需求。


I am a computer science student currently doing an internship. My boss has asked me to write a simple tool to monitor a Tomcat server. I am just starting this project so I'm basically just playing around to see how things work. I would like to create a simple jsp page that displays the results of some basic JMX queries. I am using the Eclipse IDE. Can someone give me some tips to get started?

解决方案

You definitely don't have to re-invent the wheel, here. You can start with jconsole, which ships with your JDK: just run jconsole [pid] and jconsole will connect to the (locally) running process and let you observe everything via JMX.

If you want remote access to JMX-exposed information, you can use Tomcat's manager webapp along with the included jmxproxy servlet which allows you to remotely perform simple queries to get (and set) JMX properties.

There are other more fully-featured projects such as Jolokia ( http://www.jolokia.org/) that do similar kinds of things.

Assuming that you are using something like Nagios to automatically observe your Tomcat instance, something you definitely don't want to do it spin-up a JVM and make a remote (or even local) JMX connection to inspect a single JMX property (and then do that 5 times to observe 5 different properties, then do those 5 samples every 5 minutes, or 1 minute, or whatever). Instead, you probably want to use a proxy like one described above.

We've had great success coupling Nagios with the Tomcat manager's jmxproxy servlet. It will likely meet your needs for quite a while.

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

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