Skip to content

Jboss JMX with Hyperic

November 9, 2009
tags: , ,

One of the uses of JMX is for exposing any data across remotely.
If you need to use Jboss and Hyperic for JMX configuration then following configurations are required:

1. Select a property to be exposed. To test: take Catalina:type=StringCache , this is existing by default.
2. In Hyperic you can create the plugin .xml file either in the /hq-plugins folder or in the /hq/agent-4.1.3/bundles/agent-4.1.3-1067/pdk plugins folder.

3. The plugin xml file for String cache jmx  attr named: cacheSize in the file customjmx-plugin.xml  is below:

<?xml version="1.0"?>
<plugin name="customjmx" package="org.hyperic.hq.product.jmx">
  <classpath>
    <include name="pdk/lib/mx4j"/>
  </classpath>

  <config name="jmx" type="global">
    <option name="jmx.url"
            description="JMX URL to MBeanServer"
            default="service:jmx:rmi:///jndi/rmi://machineName:12345/jmxrmi"/>
  </config>

<property name="BEAN_NAME"
            value="Catalina:type=StringCache"/>
<server name="jboss_jmx">
          <property name="PROC_HOME_PROPERTY" value="program.name=testJboss.sh"/>
          <property name="PROC_MAIN_CLASS" value="org.jboss.Main"/>
	  <plugin type="autoinventory"
		class="org.hyperic.hq.product.jmx.MxServerDetector"/>
	<plugin type="measurement"
			class="org.hyperic.hq.product.jmx.MxMeasurementPlugin"/>
          <metric name="cacheSize"
                  template="${BEAN_NAME}:cacheSize"
                  alias="cacheSize"
                  indicator="true"/>
 </server>
</plugin>

Hyperic uses SIGAR for discovering processes and the PTQL is the process table query language used.
Launch sigar using java -jar sigar.jar and test the ptql in this prompt.

The important thing to know is that arguments to ps command can be seen through pargs <process_id> and then knowing that -D is appended by default when the main class is defined and then the final sigar cmd becomes:

ps  State.Name.sw=java,Args.*.eq=org.jboss.Main,Args.*.re=-Dprogram.name=testJboss.sh

Where the value program.name=testJboss.sh is defined in the customjmx-plugin.xml in the PROC_HOME_PROPERTY value.

Also, recall that if you need to associate your custom Mbean with jboss mbean viewer – then you need to register your mbean in the jboss specific mbean server whose instances can be found through the following defined ways.

Also, to expose the jboss mbeans – to jconsole – follow the steps detailed here.

I modified the run.conf with the following java opts.

JAVA_OPTS=”-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false  -Djboss.platform.mbeanserver -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl ”

 

To test if your plugin works:

java -jar /home/hyp/hq/agent-4.1.3/bundles/agent-4.1.3-1067/pdk/lib/hq-product.jar -Dplugins.include=customjmx  -m discover -a metric -Dlog=DEBUG

It took some time – to identify this – mainly because of incomplete(and incorrect!_) documentation which is the evil part of using open source – the good thing was – the hyperic forum is definitely alive

Advertisements
2 Comments leave one →
  1. swati permalink
    July 8, 2012 12:22 pm

    Hi
    i have hyperic 4.6(open source) installed on linux and want to configure jboss 6.0 with jmx enabled with userid and password . But its giving me configuration error. so can i use the above plugin and include below code to control it

    • techzen permalink*
      August 3, 2012 4:53 pm

      You would need to test it out yourself. Not sure of the version compatibility.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: