You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ziggy <zi...@gmail.com> on 2011/01/06 13:44:56 UTC
Tomcat monitoring using JMX
Hi,
I am using JMX to connect to a Tomcat instance and looking at attributes for
a jdbc datasource as shown below.
MBeanServerConnection conn = jmxc.getMBeanServerConnection();
ObjectName on = new
ObjectName("Catalina:type=DataSource,path=/appdb,host=localhost,class=javax.sql.DataSource,name=\"jdbc/appdb\"");
mbsc.getAttribute(on, "numIdle")
Is there an Mbean provided by Tomcat that can provide me the following
information
- Whether Tomcat is running
- Whether a specific web app running under a specific context is runnin
- 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.
I have been google'ing around but the majority of the examples talk about
writing your own Mbean and including it as part of the application. I am
trying to write an external client utility that will monitor the application
away from Tomcat.
Thanks
Re: Tomcat monitoring using JMX
Posted by Pid <pi...@pidster.com>.
On 1/6/11 12:44 PM, Ziggy wrote:
> Hi,
>
> I am using JMX to connect to a Tomcat instance and looking at attributes for
> a jdbc datasource as shown below.
>
> MBeanServerConnection conn = jmxc.getMBeanServerConnection();
> ObjectName on = new
> ObjectName("Catalina:type=DataSource,path=/appdb,host=localhost,class=javax.sql.DataSource,name=\"jdbc/appdb\"");
> mbsc.getAttribute(on, "numIdle")
>
> Is there an Mbean provided by Tomcat that can provide me the following
> information
>
> - Whether Tomcat is running
Well you won't be able to connect to it to get the Bean if it's isn't.
> - Whether a specific web app running under a specific context is runnin
Catalina:type=WebModule,... etc
> - The health of the environment in general (tomcat, OS etc)
Define "health".
> - Whether a JNDI datasource is available and if possible how many active
> database connections there are and how many free.
You've already got the DataSource above, why not connect JConsole to
Tomcat and explore the other attributes?
> I have been google'ing around but the majority of the examples talk about
> writing your own Mbean and including it as part of the application. I am
> trying to write an external client utility that will monitor the application
> away from Tomcat.
JConsole? VisualVM?
p
> Thanks
>