We have a use-case where we need to monitor batch processes that only run for a given amount of time. The JMX exporter works great on longer running processes, but for batch processes we would like to have a way in the exporter to push metrics vs pull. I believe statement is in alignment with the use case for the Prometheus Push Gateway (
https://github.com/prometheus/pushgateway).
I started a fork here (
https://github.com/tjg184/jmx_exporter) but wanted to get some additional thoughts before finishing with a pull request. In short, it works very similar to the existing agent except instead of starting a HTTP server for scraping metrics, it uses the push gateway client to push those metrics. From a user's perspective, they just switch out the jar and change host/port if needed.
java -javaagent:./jmx_prometheus_javaagent_gateway-0.12.0.jar=9091:config.yaml -jar yourJar.jar