Announcement Announcement Module
Collapse
No announcement yet.
Spring Instrumented jars, MBeans and Hyperic Auto discovery Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Instrumented jars, MBeans and Hyperic Auto discovery

    All,

    We are attempting to leverage the Spring instrumented jars for providing monitoring within our application. We would like to have the beans / mbeans be auto discoverd by the Hyperic Agent and exposed to Hyperic HQ. With the use of the @ManagedMetric tag we are able to have the mbean discovered by the hyperic agent and made available to Hyperic HQ. So far we have done our testing with Spring version 3.0.3.RELEASE and the corresponding instrumented files. We need to be able to support this in version 2.5.x with the use of the 2.5.7.SR01 Spring instrumented files.

    General Problem:

    I have create a simple application that exposes 1 mbean and has 3 classes which are annotated with one of the following @Service, @Component or @ManagedResource. One of the classes does little more then simulate traffic so that the mbean is updated to ensure that the values appear correctly in Hyperic HQ after the resource is imported. I believe followed the instructions provided here. When the application is started I can see the mbean correctly and the classes annotated with @Service and @Component show up. However, for the classes annotated with @Service and @Component the only attributes I see for these is "MonitoringEnabled" with a valu of true. Based on the documentation, I thought I would see the following as well:

    Code:
    AverageElapsedExecutionTime(ms)
    ExecutionsPerSecond
    InvocationCount
    MaximumExecutionTime(ms)
    MinimumExecutionTime(ms)
    ThrownExceptionCount
    The BeanFactory and ApplicationContext are showing up and reporting the correct metrics, but none of my @Service or @Componet classes are.

    In looking at the log file, I do notic the follwoing WARNING at the start of the application:

    Code:
    [2010.07.22 10:23:16.108 EDT] [WARN ] [c.s.m.i.s.a.ApplicationContextMonitor] [main] [isEnabled] [Could not advise method execution.  MonitoredOperationFactory was not found]
    I also notice several other warnings related to the com.springsource.management.agent.config and the missing resource "management.config".

    Code:
    [2010.07.22 10:23:16.841 EDT] [INFO ] [o.s.b.f.c.PropertyPlaceholderConfigurer] [main] [loadProperties] [Loading properties file from class path resource [com/springsource/management/agent/config/management.config]]
    [2010.07.22 10:23:16.842 EDT] [INFO ] [o.s.b.f.c.PropertyPlaceholderConfigurer] [main] [loadProperties] [Loading properties file from class path resource [management.config]]
    [2010.07.22 10:23:16.842 EDT] [WARN ] [o.s.b.f.c.PropertyPlaceholderConfigurer] [main] [loadProperties] [Could not load properties from class path resource [management.config]: class path resource [management.config] cannot be opened because it does not exist]
    I did not see anyting in the insructions on using the instrumented files related to the "management.config" file and am not quite clear if this is part of my problem or what its purpose is or how to configure it, but the warning is true it does not exist.

    Finally, I see this waring at the end of the starting of the application that along with the first warning makes me think I am missing something quite fundamental:

    Code:
    [2010.07.22 10:23:17.675 EDT] [WARN ] [c.s.m.i.s.a.ApplicationContextMonitor] [main] [handleOperationNotFound] [A monitored operation could not be reported to the management system.  No matching monitored operation was found for monitored operation with key MonitorInstanceKey[label=refresh,targetInstance=Todd's Spring Monitored Application: startup date [Thu Jul 22 10:23:17 EDT 2010]; root of context hierarchy]]
    I have checked that the objectName of the MBean is "spring.appliation:application=ServerManager, name=ServerManagerImpl, type=ServerManager", key being "spring.application", and the mbean is being found just fine. I also add the following system property per the instructions to the startup as this is a simple stanalone application, "-Dspring.managed.application.name=ToddServerManager ".

    The application context looks as follows:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:task="http://www.springframework.org/schema/task"       
           xsi:schemaLocation="http://www.springframework.org/schema/beans 
                               http://www.springframework.org/schema/beans/spring-beans.xsd
                               http://www.springframework.org/schema/context 
                               http://www.springframework.org/schema/context/spring-context.xsd
                               http://www.springframework.org/schema/task 
                               http://www.springframework.org/schema/task/spring-task.xsd">
     
        <context:component-scan base-package="com.ihg.crm.monitoring" />
        
        <context:mbean-export registration="ignoreExisting" />
            
        <!-- Get reference to existing MBean Server -->
        <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
            <property name="locateExistingServerIfPossible" value="true" />
        </bean>
    	
        <bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
              p:port="11099" p:alwaysCreate="true" />
        <!-- Expose JMX over RMI -->
        <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean" depends-on="registry"
        	  p:server-ref="mbeanServer"
              p:objectName="connector:name=rmi"
              p:threaded="true"
              p:daemon="true"
              p:serviceUrl="service:jmx:rmi://localhost:10099/jndi/rmi://localhost:11099/jmxrmi" />
    	   
    	<bean id="serverManager" class="com.ihg.crm.monitoring.poc.jmx.ServerManagerImpl" />
    	 
        <!-- Client connector to JMX over RMI -->
    	<bean id="clientConnector" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean"
              p:serviceUrl="service:jmx:rmi://localhost:10099/jndi/rmi://localhost:11099/jmxrmi" />
    
    	<!-- Generate some traffic to see if counters show up in HypericHQ -->
        <task:annotation-driven executor="myExecutor" />
        <task:executor id="myExecutor" pool-size="10" />
        <!-- Schedule a task to execute every 10 seconds with a 3 second offset -->
    	<task:scheduled-tasks>
    	    <task:scheduled ref="simulateTrafficProcessor" method="process" cron="3/10 * * * * ?" />
    	</task:scheduled-tasks>
                      
    </beans>
    Questions:

    1. Where is the MontitoredOperationFactory located? I do not seem to be able to find any reference to this. I found this it is in com.springsource.management.agent.monitoring-3.0.3.RELEASE.jar which is on the classpath of the application, so I'm not sure why I see the first WARN log entry.
    2. Is the management.config required? If so where is this documented and what needs to go in there?
    3. Is the reason I am not seeing any of the other metrics for the @Service and @Component classes is because of #1 above or is it some other issue?
    4. Is there something else that I need to do inside of the @Service and @Component classes to have the metrics show up?
    5. For this to work with 2.5.x of Spring and 2.5.7.SR01 of the Instrumented files, where is the @ManagedMetric tag located in the instrumented jars?

    I have attached a copy of the log file that is generated upon start up with a "TRACE" level and a zip of the project itself which contains the pom with the reference to the what I believe are the appropriate jars based on the instructions and the overall project.

    TIA for your assistances and if any additional information would be of use please let me know.

    Regards,
    Todd
    Last edited by tnist; Jul 22nd, 2010, 02:11 PM.

  • #2
    Hi Todd,

    I am trying to locate these instumented jars but unable to do so. Can you please help me with URL where I can find these jars.

    Thanks a lot.

    Best Regards - Roy

    Comment


    • #3
      ok this is a bit late in coming but heres a reference to them. they are not publicly available.

      http://static.springsource.com/proje...t.html#addjars

      Still having the issue in some cases at least.

      Comment

      Working...
      X