9 Replies Latest reply on May 21, 2009 8:36 AM by mazz

    monitoring web services

    Martin F Newbie

      Hello to all!
      I am quite new to JOPR & JON, and i have been given task to enable monitoring of specified web services endpoints in web applications. As i can see that JON (current 2.2 version) can monitor whole .war, but it doesn't go deeper. What approach & solution would you suggest would be most effective for such task?
      Currently what i can think about is adding servlet filter to every application, and doing monitoring stuff there, putting data to some MBean and try to gather them with new plugin. Plugin would extend existing AS. But maybe i get it wrong and there is better way ...
      Thanx for any useful information!

      Martin

        • 1. Re: monitoring web services
          mazz Master

          Consider doing this - its pretty easy (assuming you have or write MBeans that emit measurements for your app):

          Just extend the jmx plugin to collect measurements from those MBeans by defining your MBean metadata in a plugin descriptor. We have a custom-jmx-plugin example that can get you started on that. There would be no Java code you'd have to write for your plugin - just some .xml metadata that you package as a plugin .jar. The only Java code you would write would be the MBean code that runs in your app (if you do not already have the MBeans).

          http://svn.rhq-project.org/repos/rhq/trunk/etc/custom-jmx-plugin/

          That above is already a maven module, check it out and "mvn package" it and out comes a plugin jar that you should be able to deploy in your server (Administration>SystemConfiguration>Plugins from the server UI). Once in your server, restart your agent and it'll pull down the new plugin and start using it.

          • 3. Re: monitoring web services
            Martin F Newbie

            Thank you guys very much for pointing me to right direction ;)

            • 4. Re: monitoring web services
              Martin F Newbie

              one quick question regarding JMX:
              In my JON 2.2.0, i have generic JMX plugin installed and active. I have several EAP 4.3 servers running and monitored, but i don't see anywhere any JMX subtree for monitoring. So my question is: what is proper way to connect to EAP's JMX and see all things that documentation mentions?

              • 5. Re: monitoring web services
                mazz Master

                By "JMX Subtree" I assume yuo mean all the Java5 platform MBeans right? Things like the memory subsystem MBean, threading subsystem MBean, etc.

                In order for JBossAS to expose them (and thus for the Jopr JMX plugin to monitor them) you need to pass the following system property to JBossAS when you start your app server:

                -Djboss.platform.mbeanserver

                This tells JBossAS to use the platform MBeanServer as ITS MbeanServer - thus, all MBeans - both JBoss's and the Java5 platform's MBeans will be in there.

                • 6. Re: monitoring web services
                  Martin F Newbie

                  Thanx, that setting showed new branch in server tree. It is not full JMX, but many important data mostly about JVM. I was looking into custom-jmx-plugin demo, but for me it only works for separate JMX servers like in this example.
                  I found out that JBossWS exposes MBean with needed statistics for every endpoint, so for my problem i only need to gather data from existing MBeans. So what i need to do is connect to JMX beans in JBoss AS, with name like this:
                  jboss.ws:context=wsexample,endpoint=personservice.PersonService (according to JMX console).
                  When i tried to add third service type in demo

                  <service name="THIRD Custom Service"
                   description="Our THIRD MBean custom service whose 'id' is static"
                   discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
                   class="org.rhq.plugins.jmx.MBeanResourceComponent">
                  
                   <runs-inside>
                   <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
                   </runs-inside>
                  
                   <plugin-configuration>
                   <c:simple-property name="objectName" readOnly="true" default="jboss.ws:context=wsexample,endpoint=personservice.PersonService"/>
                   </plugin-configuration>
                  
                   </service>

                  no discovery happened. Is the config wrong or do i need to add something else?

                  • 7. Re: monitoring web services
                    mazz Master

                    1) are you sure the agent has your updated plugin? execute the "plugins update" agent prompt command to make sure

                    2) if you know your plugin is already up to date, you have to wait for the next service scan to execute. See http://jopr.org/confluence/display/JOPR2/FAQ#FAQ-Explainhowtheagentscansforresources. You can force a full scan via the agent prompt command "discovery -f".

                    3) and of course make sure you confirmed that your JBossAS instance has that MBean registered and accessible. You can use twiddle if you want to double check - for example: twiddle.sh -s jnp://localhost:1099 query jboss.ws:*

                    Last resource, see if your agent log is logging any error messages related to the discovery of this service.

                    • 8. Re: monitoring web services
                      Martin F Newbie

                      Thanks for advices, but they didn't work for me.
                      When I deploy new version of plugin, i always undeploy current discovered server, scan for updated plugin (time in plugins list changes), call update on agent and after that go to auto-discovery.
                      This is my current version of plugin:

                      <?xml version="1.0" encoding="UTF-8" ?>
                      
                      <plugin name="CustomJmx"
                       displayName="Custom JMX Plugin"
                       version="1.0"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xmlns="urn:xmlns:rhq-plugin"
                       xmlns:c="urn:xmlns:rhq-configuration">
                      
                       <depends plugin="JMX" useClasses="true"/>
                       <depends plugin="JBossAS"/>
                      
                       <service name="THIRD Custom Service"
                       description="Our THIRD MBean custom service whose 'id' is static"
                       discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
                       class="org.rhq.plugins.jmx.MBeanResourceComponent">
                      
                       <runs-inside>
                       <parent-resource-type name="JMX Server" plugin="JMX"/>
                       <parent-resource-type name="JBossAS Server" plugin="JBossAS"/>
                       </runs-inside>
                      
                       <plugin-configuration>
                       <c:simple-property name="objectName" readOnly="true" default="jboss.ws:context=wsexample,endpoint=personservice.PersonService"/>
                       </plugin-configuration>
                      
                       </service>
                      
                      </plugin>

                      Twiddle discovers this bean (port 1299 for me), when i query exact name there is no problem. With plugin mentioned above no auto-discovery happens, even when forcing agent with that command. No errors in agent log (only when i turned off separate jmx server and left original demo services there, he tried in discovery to connect to port 19988. How did he know the address? :)).

                      • 9. Re: monitoring web services
                        mazz Master

                        It knew the 19988 address because the JMX plugin's discovery component scans the process table, finds the running Java process and looks for the -Dcom.sun.management.jmxremote.port command line option - if it finds it, it uses that as the port it needs.

                        I would take a look at the rhq-server plugin code - we do exactly what you want to do for the server itself - the Jopr Server has special MBeans registered by Jopr and we created services for it. See here:

                        https://anonsvn.jboss.org/repos/jopr/trunk/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml

                        Look at the "RHQ Server Measurement Subsystem" service for example.