Announcement Announcement Module
Collapse
No announcement yet.
Can Hyperic auto-detect MBeans without Instrumented Spring? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can Hyperic auto-detect MBeans without Instrumented Spring?

    I'm successfully running Hyperic Open Source 4.2.0.7 to monitor a webapp running on Apache Tomcat 6.0.16.

    I have exported a custom component of my webapp to JMX as described here, and it shows up in JConsole as expected.

    Code:
    @ManagedResource(objectName="spring.application:application=swf-booking-mvc,
      type=MessageListener,
      name=bookingQueueMessageListener")
    public class MyClass {
    ...
      @ManagedMetric(category="utilization", displayName="Message Queue Size", 
        description="The size of the Message Queue", 
        metricType = MetricType.COUNTER, unit="messages")
      public int getQueueSize(){
      ...
    Code:
    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
      <property name="autodetect" value="true" />
      <property name="assembler" ref="assembler" />
      <property name="namingStrategy" ref="namingStrategy" />
    </bean>
    
    <bean id="attributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
    
    <bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
      <property name="attributeSource" ref="attributeSource"/>
    </bean>
    
    <bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
      <property name="attributeSource" ref="attributeSource" />
    </bean>
    Now is it at all possible to have Hyperic auto-detect this bean without using the Instrumented Spring Framework jars in my webapp? I wouldn't mind building a custom Hyperic plugin if necessary.

    Thanks,
    Dan

  • #2
    It turns out my setup was basically correct (as documented here).

    The Linux server showed up in Hyperic's Auto-Discovery panel, but the tomcat containing my application with the new metric was not listed underneath (instead, other instances of tomcat were shown, which I did not want monitored). That's why I didn't klick "Add to inventory" initially. Only when I did so out of desperation, the new metric showed up.

    So it's not quite intuitive, but at least it's possible.

    Comment


    • #3
      I'm having the same problem as the previous poster (dan.baumann), and haven't found a solution yet. I'm evaluating HQ Version 4.2.0.7-EE (build #1284 - Mar 24, 2010 - Release Build), in conjunction with a simple webapp built with Spring Framework 3.0.1.RELEASE. I've tried deploying the webapp in SpringSource tc Server as well as in Tomcat 6.0.26, with the same result in each case; Hyperic autodiscovers the servlet container but doesn't show my custom MBeans.

      I'm trying to get Hyperic to auto-discover some custom MBeans in my webapp (see code below). I followed the same procedure as dan.baumann, using the steps shown here. My custom MBeans show up fine in JConsole, but I can't get Hyperic to discover them.

      My webapp is built with standard Spring 3.0.1, not instrumented Spring.

      Code:
      @ManagedResource(objectName = "spring.application:application=eservices, type=ResourcePool, name=httpClientPoolImpl",
              description = "HTTP Client Pool")
      public class HttpClientPoolImpl implements HttpClientPool {
      ....
      @ManagedMetric(category = "utilization", displayName = "Number of clients available",
                  description = "The number of HTTP clients available in the pool",
                  metricType = MetricType.GAUGE, unit = "none")
          public synchronized int getNumberOfClientsAvailable() {
              return clientsAvailable;
          }
      The following extract from the Hyperic agent's logfile shows that the autodiscoverer is throwing a NullPointerException:

      Code:
      2010-06-08 15:59:28,304 INFO  [Thread-2] [RuntimeAutodiscoverer] Running runtime autodiscovery for SpringSource tc Runtime 6.0
      2010-06-08 15:59:28,344 ERROR [Thread-2] [RuntimeAutodiscoverer] Unexpected error running autodiscoverer for plugin: SpringSource
      java.lang.NullPointerException
              at java.util.Hashtable.put(Hashtable.java:394)
              at org.hyperic.hq.product.PluginUpdater.addProperties(PluginUpdater.java:77)
              at org.hyperic.hq.product.PluginUpdater.updatePluginData(PluginUpdater.java:84)
              at org.hyperic.hq.product.PluginUpdater.updateServiceTypes(PluginUpdater.java:110)
              at org.hyperic.hq.product.ServerDetector.discoverResources(ServerDetector.java:218)
              at org.hyperic.hq.autoinventory.agent.server.RuntimeAutodiscoverer.doRuntimeScan_internal(RuntimeAutodiscoverer.java:272)
              at org.hyperic.hq.autoinventory.agent.server.RuntimeAutodiscoverer.doRuntimeScan(RuntimeAutodiscoverer.java:205)
              at org.hyperic.hq.autoinventory.ScanManager.mainRunLoop(ScanManager.java:165)
              at org.hyperic.hq.autoinventory.ScanManager.access$000(ScanManager.java:41)
      I'd really appreciate some help. Presumably the NullPointerException means there is a bug in Hyperic? But I don't know if it is this bug that is preventing the auto-discovery.

      Thanks,
      Rob

      Comment


      • #4
        Just to be clear: The setup described above did actually work for me, it's just that the servlet container hosting my custom metric did not show up in the austodiscovery panel.

        Comment


        • #5
          Originally posted by dan.baumann View Post
          Just to be clear: The setup described above did actually work for me, it's just that the servlet container hosting my custom metric did not show up in the austodiscovery panel.
          Thanks for the prompt reply, Dan!

          Where did the new metric show up? As a service in the "Services" panel of the "Resources -> Inventory" tab? And what was the name of the service according to HQ? (I presume it was prepended with the name of the Linux server). If you had multiple metrics, did each show up as a separate service?

          Thanks for your help!
          Regards,
          Rob

          Comment


          • #6
            I used a single metric only ("Counter size"), and it looks like this.

            Comment


            • #7
              Thanks Dan, I tried a few more times and eventually the custom metrics did show up. I'm not sure why they didn't show up the first time.

              Comment


              • #8
                Same here, basically. If you ever find out why this is so, please let me know.

                Comment


                • #9
                  Hi Guys,

                  I am struggling to display my Spring custom metrics in Hyperic but could not succeed till now.

                  I had already logged a thread on this

                  http://forums.hyperic.com/jiveforums...D=36124&#36124


                  Can anyone of you please let me know what I am missing.

                  Thanks a lot.

                  Best Regards - Roy

                  Comment

                  Working...
                  X