VMware Cloud Community
rgause
Contributor
Contributor

Custom JMX Configuration Problem

I've read the two tutorials and several threads on this and I now have a config that gets past the lifecycle checks. However, I can not seem to get the discover or metric checks to pick up anything.

Background: I have several mbeans deployed and running in a Tomcat 6 container. Tomcat gets picked up by the tomcat plugin, and now I am trying to monitor some of the other mbeans.

I've attached the plugin, the output of the JMX MBeanDumper, the lifecycle run, the metric run, and the discover run.

What am I doing wrong?
0 Kudos
3 Replies
ama_hyperic
Hot Shot
Hot Shot

You need to specify a class to use for autoinventory. MXServerDetector extends DaemonDetector so you can pass in a ptql query to satisfy the criteria for auto discovery of something. In this case, use sigar and a ptql query to narrow down the specific java process youre interested in. Also, try defining this as a server instead of a service.

<!-- AutoDiscovery -->
<property name="PROC_HOME_ENV" value="JAVA_HOME"/>
<property name="PROC_HOME_PROPERTY" value="ptql:State.Name.eq=java,Args.*.ct=Agent"/>
<property name="PROC_MAIN_CLASS" value="proc.java.home"/>
<plugin type="autoinventory" class="org.hyperic.hq.product.jmx.MxServerDetector"/>
0 Kudos
rgause
Contributor
Contributor

OK, that get's me a little further....

I ran sigar and played with some queries to identify my tomcat process. Here is the output from sigar:

sigar> ps State.Name.sw=java
4262 hyperic May4 1.0G 338M 3.6M S 602:21 java:org.jboss.Main
10876 tomcat May22 822M 418M 5.2M S 55:51 /usr/lib/jvm/java-1.6.0-sun-1.6.0.u7/jre/bin/java
22037 root May5 391M 40M 5.9M S 1765:25 java:org.tanukisoftware.wrapper.WrapperStartStopApp
23509 hyperic 09:47 255M 16M 8.3M R 0:0 java:org.hyperic.sigar.cmd.Runner
sigar> pargs 10876
pid=10876
exe=???
cwd=???
0=>/usr/lib/jvm/java-1.6.0-sun-1.6.0.u7/jre/bin/java
1=>-Djava.awt.headless=true
2=>-Xms256m
3=>-Xmx512m
4=>-XX:MaxPermSize=150m
5=>-XX:PermSize=50m
6=>-Dcom.sun.management.jmxremote.port=8082
7=>-Dcom.sun.management.jmxremote.protocol.port=8083
8=>-javaagent:/usr/share/java/jmxagent.jar
9=>-Dcom.sun.management.jmxremote.ssl=false
10=>-Dcom.sun.management.jmxremote.authenticate=true
11=>-Dcom.sun.management.jmxremote.password.file=/usr/share/tomcat6/conf/jmxremote.password
12=>-Dcom.sun.management.jmxremote.access.file=/usr/share/tomcat6/conf/jmxremote.access
13=>-classpath
14=>/usr/share/java/xalan-j2-serializer.jar:/usr/share/java/xalan-j2.jar:/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
15=>-Dcatalina.base=/usr/share/tomcat6
--More-- (Page 1 of 2)
16=>-Dcatalina.home=/usr/share/tomcat6
17=>-Djava.endorsed.dirs=
18=>-Djava.io.tmpdir=/var/cache/tomcat6/temp
19=>-Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties
20=>-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
21=>org.apache.catalina.startup.Bootstrap
22=>start

------------------------

sigar>

That got me to a query of:

sigar> ps State.Name.sw=java,Args.*.eq=org.apache.catalina.startup.Bootstrap
10876 tomcat May22 822M 407M 5.2M S 56:50 /usr/lib/jvm/java-1.6.0-sun-1.6.0.u7/jre/bin/java
sigar>

Running that in the plugin still gets me nothing - there is an added "Args.*.sw=-D".

OK, look at the Javadocs for the MxServerDetector plugin. Fields show up, but have no descriptions/usage instructions.

OK, download source, and review MxServerDetector.java. Now I see how the properties are being used - edit the config, and rerun.... Search is now:

State.Name.sw=java,Args.*.eq=org.apache.catalina.startup.Bootstrap,Args.*.sw=-Dcatalina.home=

sigar looks like this on that query:

sigar> ps State.Name.sw=java,Args.*.eq=org.apache.catalina.startup.Bootstrap,A$
10876 tomcat May22 820M 417M 5.1M S 58:20 /usr/lib/jvm/java-1.6.0-sun-1.6.0.u7/jre/bin/java
sigar>

Run the plugin in discover mode and.... Bing Bing Bing - 1 process discovered!

On to the next battle. The jmx url, username, & password being defined in my xml file are not being picked up by the MxServerDetector.

If I pass them on the command line, the username & password are picked up, but my specified URL is ignored. It seems to insist on using the discovered url which is on a different port.

jconsole with the specified url, username, & password works. jconsole to the discovered port, has never worked (another story...).

Do I need to specify the url someplace else, other than in the config section?

Thanks again!
Bob
0 Kudos
admin
Immortal
Immortal

.....






zzzzz
0 Kudos