Friday, August 15, 2008

RHQ monitor arbitrary JMX servers (Eclipse as example)

While RHQ is focusing on providing specific resource types with specific operations and metrics on them, it is possible to just connect to any JMX server (actually that code is in SVN Head as of today).

This example will show you how you could use this to e.g. monitor your Eclipse instance. This basically consists of two steps:
  • instrument the target app -- Eclipse in this case

  • manually add a JMX server to the RHQ inventory


Step 1: instrument Eclipse



Add the following to eclipse.ini:


-Dcom.sun.management.jmxremote

-Dcom.sun.management.jmxremote.port=10000


as we don't want for this example password authentication and ssl (of course you should do that for production, but we want to concentrate on how to initiate the connection at all), we disable it by supplying


-Dcom.sun.management.jmxremote.authenticate=false

-Dcom.sun.management.jmxremote.ssl=false


and restart Eclipse afterwards.

This page at Sun explains the various options for JMX remoting in JDK5.

Step 2: Manually add a JMX server in RHQ



Go to the inventory tab of the platform and select "Manually Add": "Jmx Server" below the list of child resources. Press OK

JMX_add_1.png


On the next screen select "JDK 5" from the drop down and continue:

JMX_add_2.png


The following screen will show prefilled connection properties - here we need to set port 10000 from above:

JMX_add_3.png


Click on OK and the new Java VM should appear. After some waiting, you will see the inidividual MBeans as you know it from other services in RHQ:

JMX_add_4.png








Technorati Tags:
,


1 comment:

berggeist said...

Is ist possible to call custom MBean operations without writing a plugin?