-
Notifications
You must be signed in to change notification settings - Fork 0
Home
In process JMX metrics exporter. Inspired by the standalone version of jmxtrans but embedded inside your java process (e.g. Tomcat).
An in process JMX Exporter will solve the problem of remote JMX access in cloud-style and elastic environments where the IP address of the Java servers is unknown and where RMI-IIOP is disabled (e.g. Amazon Elastic Beanstalk, Cloudbees, ...).
Getting started guide for Spring Framework enabled web applications.
Add embedded-jmxtrans
dependency
<dependency>
<groupId>org.jmxtrans.embedded</groupId>
<artifactId>embedded-jmxtrans</artifactId>
<version>1.0.8</version>
</dependency>
Declare <jmxtrans:jmxtrans>
in your Spring configuration :
<beans ...
xmlns:jmxtrans="http://www.jmxtrans.org/schema/embedded"
xsi:schemaLocation="...
http://www.jmxtrans.org/schema/embedded http://www.jmxtrans.org/schema/embedded/jmxtrans-1.0.xsd">
<jmxtrans:jmxtrans>
<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: Before version 1.0.1, don't forget to declare <context:annotation-config/>
to handle embedded-jmxtrans' lifecycle annotation @PreDestroy
at shutdown.
Create src/main/resources/jmxtrans.json
, add your mbeans and declare both ConsoleWriter
(output to stdout
) and GraphiteWriter
{
"queries": [
{
"objectName": "com.cocktail:type=CocktailService,name=cocktailService",
"resultAlias": "cocktail.controller",
"attributes": ["SearchedCocktailCount", "DisplayedCocktailCount", "SendCocktailRecipeCount"]
}
],
"outputWriters": [
{
"@class": "org.jmxtrans.embedded.output.ConsoleWriter"
},
{
"@class": "org.jmxtrans.embedded.output.GraphiteWriter",
"settings": {
"host": "${graphite.host:localhost}",
"port": "${graphite.port:2003}"
}
}
]
}
In this sample, Graphite host & port are defaulted to localhost:2003
and can be overwritten with system properties or environment variables, for example in $CATALINA_BASE/conf/catalina.properties
.
...
jvm.os.SystemLoadAverage 2.97265625 1358242428
tomcat.thread-pool.http-8080.currentThreadsBusy 0 1358242458
tomcat.manager.localhost._.activeSessions 0 1358242458
tomcat.servlet.__localhost_.jsp.processingTime 0 1358242458
tomcat.servlet.__localhost_.jsp.errorCount 0 1358242458
tomcat.servlet.__localhost_.jsp.requestCount 0 1358242458
cocktail.controller.SearchedCocktailCount 12 1358242458
...
- Configuration
- ... Expression Language
- ... Configuration Sample
- Output Writers
- ... Graphite Writer
- ... Graphite Pickle Writer
- ... Librato Writer
- ... SLF4J Writer
- ... Console Writer
- Integration
- ... Maven Setup
- ... Spring Integration
- ... Plain Java Servlet Integration
- Configuration Templates
- ... Tomcat
- ... JVM
- Internals
- ... Implementation Decisions
- ... Health Monitoring
- Latest javadocs
- Forum (Google Groups)
- Downloads
- Samples
- ... [Cocktail Web App] (https://github.com/jmxtrans/embedded-jmxtrans-samples/tree/master/embedded-jmxtrans-webapp-coktail)
- License
- Release Notes