Skip to content

Sidecar Docker container for injecting Prometheus JMX exporter stuff into your Java apps.

Notifications You must be signed in to change notification settings

ironsource-mobile/prometheus-jmx-exporter-kubernetes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus JMX Exporter container for Kubernetes

This is a Docker container intended to be run in the same pod as your Java containers, to export their metrics for Prometheus.

The default CMD copies over the required JMX Exporter files to the directory specified by the SHARED_VOLUME_PATH environment variable.

Files available

  • $SHARED_VOLUME_PATH/jmx_prometheus_javaagent.jar: the JMX Exporter javaagent JAR file.
  • $SHARED_VOLUME_PATH/config/*.yaml: example config files for the exporter.

Using this as a Kubernetes Init Container

This container is best used as an Init Container.

Add this to initContainers of your Deployment or StatefulSet:

spec:
  initContainers:
  - name: prometheus-jmx-exporter
    image: spdigital/prometheus-jmx-exporter-kubernetes:0.3.1
    env:
    - name: SHARED_VOLUME_PATH
      value: /shared-volume
    volumeMounts:
    - mountPath: /shared-volume
      name: shared-volume

The init container and your Kafka container will share a volume:

volumes:
- name: shared-volume
  emptyDir: {}

In your Kafka container, set KAFKA_OPTS to refer to files placed by the prometheus-jmx-exporter container into the shared volume:

- name: KAFKA_OPTS
  value: -javaagent:/shared-volume/jmx_prometheus_javaagent.jar=19000:/shared-volume/configs/kafka-config.yaml

Don't forget to annotate your resources so Prometheus will scrape your pod's /metrics endpoint:

annotations:
  "prometheus.io/scrape": "true"
  "prometheus.io/port": "19000"

About

Sidecar Docker container for injecting Prometheus JMX exporter stuff into your Java apps.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 100.0%