I am trying to monitor a tomcat application using percona cacti graphs. The application works using jconsole from windows. The host is centos 6.6 64 bit and i have installed ant.
When i try to run the example given by percona it does not work for me.
[root@titan ~]# ant -Djmx.server.port=12345 -e -q -f jmx-monitor.xml -v
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
Buildfile: /root/jmx-monitor.xml
Detected Java version: 1.7 in: /usr/java/jdk1.7.0_05/jre
Detected OS: Linux
parsing buildfile /root/jmx-monitor.xml with URI = file:/root/jmx-monitor.xml
Project base dir set to: /root
parsing buildfile jar:file:/opt/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/opt/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Override ignored for property "jmx.server.port"
Build sequence for target(s) `status' is [status]
Complete build sequence is [status, ]
status:
parsing buildfile jar:file:/root/.ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml with URI = jar:file:/root/.ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml from a zip file
parsing buildfile jar:file:/opt/ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml with URI = jar:file:/opt/ant/lib/catalina-ant.jar!/org/apache/catalina/ant/jmx/antlib.xml from a zip file
Property "jmx.catalina.threadpool.name" has not been set
BUILD FAILED
/root/jmx-monitor.xml:54: javax.management.InstanceNotFoundException: Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:643)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1464)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:657)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$2.run(Transport.java:202)
at sun.rmi.transport.Transport$2.run(Transport.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:901)
at org.apache.catalina.ant.jmx.JMXAccessorGetTask.jmxGet(JMXAccessorGetTask.java:138)
at org.apache.catalina.ant.jmx.JMXAccessorGetTask.jmxExecute(JMXAccessorGetTask.java:123)
at org.apache.catalina.ant.jmx.JMXAccessorTask.execute(JMXAccessorTask.java:348)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 1 second
I have noticed I had to remove the following from the jmx-monitor.xml
to get it to work.
<jmx:get
name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}"
attribute="currentThreadsBusy"
resultproperty="currentThreadsBusy"
/>
<jmx:get
name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}"
attribute="currentThreadCount"
resultproperty="currentThreadCount"
/>
<jmx:get
name="Catalina:type=ThreadPool,name=${jmx.catalina.threadpool.name}"
attribute="maxThreads"
resultproperty="maxThreads"
/>
current_threads_busy: ${currentThreadsBusy}
current_thread_count: ${currentThreadCount}
max_threads: ${maxThreads}
How would i get it to work without remove the above. The following command is run by cati
ant -Djmx.server.port=9012 -Djmx.catalina.threadpool.name=http-8080 -e -q -f jmx-monitor.xml
According your work, I just added the following line to jmx-monitor.xml.
<property name="jmx.catalina.threadpool.name" value="http-8080" />
And it works.
ant -Djmx.server.port=12345 -e -q -f jmx-monitor.xml -v
or Just test by the following command. (I think that docs is not good in http://www.percona.com/doc/percona-monitoring-plugins/1.1/cacti/jmx-templates.html)
ant -Djmx.server.port=9012 -e -q -f jmx-monitor.xml -Djmx.catalina.threadpool.name=http-8080