See jmx_exporter for full usage.
This is an example build of a Docker image which runs Jetty and exposes JMX statistics for Prometheus over HTTP on port 9093 at /metrics
Simple:
git clone [email protected]:prometheus/jmx_exporter.git
docker run -it --volume=`pwd`/jmx_exporter:/usr/src/app -w /usr/src/app maven mvn clean install
cp jmx_exporter/jmx_prometheus_javaagent/target/jmx_prometheus_javaagent-0.7-SNAPSHOT.jar .
Only the usual magic:
docker build .
docker run -p 8080:8080 -p 9093:9093 <image ID>
Form the host machine:
curl localhost:9093/metrics