Skip to content
Simone Zorzetti edited this page Mar 12, 2016 · 8 revisions

Declare bean:

<beans ...
       xmlns:jmxtrans="http://www.jmxtrans.org/schema/embedded"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="...
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.jmxtrans.org/schema/embedded http://www.jmxtrans.org/schema/embedded/jmxtrans-1.1.xsd">

    <context:annotation-config/>

    <jmxtrans:jmxtrans configuration-scan-period-in-seconds="30">
        <jmxtrans:configuration>classpath:jmxtrans.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/tomcat-6.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/jmxtrans-internals.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/jvm-sun-hotspot.json</jmxtrans:configuration>
    </jmxtrans:jmxtrans>
</beans>

NOTE: Don't forget to declare <context:annotation-config/> to handle embedded-jmxtrans' lifecycle annotation @PreDestroy at shutdown.

<jmxtrans:jmxtrans />

  • id: optional id of the Spring bean. Default "jmxtrans"
  • configuration: coma delimited list of urls (classpath:, http://..., file:/...). Default value is classpath:jmxtrans.json, classpath:org/jmxtrans/embedded/config/jmxtrans-internals.json. Optional.
  • ignore-configuration-not-found: Specifies if failure to find the JSON configuration resource location should be ignored. Default is "false", meaning that if there is no file in the configuration specified an exception will be raised at runtime
  • 0..* children elements <jmxtrans:configuration>: urls of json configuration files (classpath:, http://..., file:/...) . You can use urls like etcd://host:port/path/key to retrieve a configuration json from an etcd kv store. If you have an etcd cluster use the syntax etcd://[host1:port1,host2:port2,...]/path/key. The members of the cluster are used only in failover mode and strictly in the sequence specified.