开发者

Which Tomcat Mbean can be used to access web app information

开发者 https://www.devze.com 2023-02-02 17:40 出处:网络
I am try开发者_开发问答ing to write a client tool which monitors an application running in Tomcat 5.5. I know there are quite a few already available but the majority of them are web based and dont pr

I am try开发者_开发问答ing to write a client tool which monitors an application running in Tomcat 5.5. I know there are quite a few already available but the majority of them are web based and dont provide a lot of support for automating the monitoring process.

The tool i am writing now is very simple. Its a client java process that connects to the Tomcat instance remotely. I have managed to connect to it but now i am stuck as to how to use the MBeans that are already available in Tomcat.

My question really is which Mbeans within Tomcat do i query to find out the following information

  • Whether a specific application running under a specific context is running
  • The health of the environment in general (tomcat, OS etc)
  • Whether a JNDI datasource is available and if possible how many active database connections there are and how many free.

Are there any MBeans that provide this info? if so how do i access it?

it would be very usefull to see a full list of all mbeans available in Tomcat and how to access them. I have seen this list http://tomcat.apache.org/tomcat-5.5-doc/catalina/funcspecs/mbean-names.html but it is quite confusing.

Thanks


You can use jConsole utility of Java to see the MBeans available in remote Tomcat server. It will connect to remote server with jmx port. All the MBeans available are listed in MBean tab. This can help you finding the MBeans you wants and exact name of the MBean attribute.

Thanks.


You could use the check_jmx4perl configuration with pre-defined Tomcat checks as a starting point. It references the names of quite some MBeans which can be found on a standard Tomcat installation.

I.e. the following metrics are pre-defined:

  • Nr. of servlet requests for a certain servlet
  • Processing CPU time for a webmodule
  • Check whether a webmodule is active
  • Active sessions
  • Max. number of active sessions
  • Number of rejected sessions
  • Average lifetime of a session
  • Max. lifetime of the longest session
  • Data received rate for a connector
  • Data sent rate for a connector
  • Processing time for a connector
  • Number of active datasource connections

You can find this sample tomcat.cfg configuration here: https://github.com/rhuss/jmx4perl/blob/master/config/tomcat.cfg

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号