6 Replies Latest reply on Mar 31, 2010 12:02 PM by mazz

    Jboss 5.1 custom JMX and JOPR

    Neil Stamps Newbie

      I know there are a number of posts about JOPR not supporting JBoss 5.1 for auto discovery, and also there are issues with JBoss JMX bean exposure. However - is it still possible to user JOPR to view custom JMX MBeans from a JBoss 5.1 instance? If it is possible, what particular steps are needed to make this work. I have tried creating a custom JMX plugin, but seem to be having problems with it being recognised.

       

      Thanks for any assistance.

        • 2. Re: Jboss 5.1 custom JMX and JOPR
          Neil Stamps Newbie

          That's great news that I am not trying the impossible!

           

          I've downloaded the example custom JMX plugin and application, and although JOPR picks it up ok, it does not show the JMX bean from the example. Is there some additional step I need to take? I put the plugin in the server and Agent, and started up the application.

           

          I enclose a screen shot of the attributes I do see.

          jmxcustom.png

          • 3. Re: Jboss 5.1 custom JMX and JOPR
            mazz Master

            That blog probably wasn't clear what you need to do.

             

            If you look at the source and binary from the blog demo you'll see this definition in the XML plugin descriptor (the META-INF/rhq-plugin.xml file):

             

            <service name="First Custom Service">

             

            What that blog demo did was take the example custom JMX plugin and added stuff to it to support custom JMX MBeans (specifically it added XML to the descriptor a new service definition representing a custom JMX MBean - that's what the "First Custom Service" is). The example custom JMX Plugin requires that you extend its descriptor file to describe your custom JMXs (that's what the blog meant when it said, "There is even already an example custom JMX plugin Maven module that you can use as a starting point, should you want to write your own custom JMX plugin - see the actual code here which you can copy and customize for your needs.").

             

            So, yes, this means you need to explicitly add metadata to the plugin's XML descriptor which describes your custom JMX beans that you want to manage.

             

            In the future (hopefully in the near future - someone in the community is already working on this), we will add the ability to support "dynamic metadata" which means you won't even have to edit the XML descriptor - we will be able to perform JMX queries to obtain the MBean information and add that info to inventory (BTW: this feature will not only be able to support JMX, but any other "discoverable" resources like QMF). For more on this dynamic metadata design, see this:

             

            http://rhq-project.org/display/RHQ/Design-Dynamic+Metadata

            • 4. Re: Jboss 5.1 custom JMX and JOPR
              Neil Stamps Newbie

              I think I must be misunderstanding or missing something obvious. I have downloaded the pre-built demo and source, and deployed the pre-built plugin to server and agent, and then started the application. The agent did pick my application up, but JOPR did not show the "first custom service" and "second custom service" which is defined in the rhq-plugin.xml

              • 5. Re: Jboss 5.1 custom JMX and JOPR
                Neil Stamps Newbie

                It's ok - I now have a working JMX application in the JOPR console. There was no change in the plugin deployment, the only change was a restart of the agent (I had previously restarted when I initially deployed the custom JMX plugin). What could be the cause of the delay in seeing the Service methods? As you see in the screen shot the JVM stats were available immediately...

                • 6. Re: Jboss 5.1 custom JMX and JOPR
                  mazz Master

                  The delay was probably the service scan period - which is by default 24 hours.

                   

                  Read this FAQ for more information on how servers and their services are scanned/discovered:

                   

                  http://rhq-project.org/display/JOPR2/FAQ#FAQ-Explainhowtheagentscansforresources

                   

                  You didn't necessarily have to restart the agent. You could have asked the agent to manually scan for everything immediately via the "discovery --full" command. I think that would have also performed a service scan for you.