This project consists of a dockerised JMX Exporter image, based on the original project created by sscaling (sscaling/docker-jmx-prometheus-exporter), using alpine-java, dumb-init and fetching the official released version of jmx_exporter from the maven central repository
The version of the official prometheus jmx-exporter currently built and supported is 0.9 (and the http version, not used as java agent).
This version of the docker includes the following extra features:
Automatic Configuration: config.xml creation based on environment variables and templates.
Static Configuration: if config.xml is mapped into /opt/jmx_exporter/config/, then environment variables won't be considered, and the provided configuration will be used.
Flexible rules: via environment variables we can select the rules to apply to the configuration (only if Automatic Configuration feature is used and only 1 rules file allowed).
check_init : With check init enabled (by default is disabled), jmx_exporter will wait until the remote jmx port is available (this feature uses nagios check_jmx plugin) before starting the exporter itself.
Environment variables supported to get different behavior/configuration:
SERVICE_PORT -- Port to receive http /metrics requests from Prometheus.
CHECK_INIT_ACTION -- (exit | continue) -- What to do in case of failing checks.
CHECK_INIT_MAX_DELAY -- Maximum time to spend checking remote JVM.
CHECK_INIT_INTERVAL -- Interval between attempts (in seconds).
Supported modules in current version (only one can be selected):
default (this will translate all mbeans to metrics)
kafka-0-2-8
The objectives of implementing these features are:
Being able to use the same docker image of jmx_exporter for different scenarios, as the configuration can be built from environment variables.
In a Kubernetes environment, run jmx_exporter docker as an extra container (sidecar) in the pod to monitor (in this case DEST_HOST should be localhost).
In a Kubernetes environment, run jmx_exporter docker in a dedicated pod, in order to monitor another pod (in this case DEST_HOST should be the name of a k8s service pointing to the pod).