How to catch jmx metrics with JMX-Exporter in HTTP server mode?

5,162 views
Skip to first unread message

daniel.la...@gmail.com

unread,
Jan 27, 2016, 9:26:54 AM1/27/16
to Prometheus Developers
Hi

I have a spring boot application running in a docker container. This application exposes jmx metrics in a port (i can see them using jconsole), but when I try to catch them with prometheus jmx_exporter I cannot get anything.

Mi conf is the following:
+ A docker container with the app exposing the metrics in the port 1099.

+ JMX_exporter (HTTP server mode) with this config.yml:
hostPort: localhost:1099
username:
password:

rules:
- pattern: ".*"

+ Run JMX exporter with the following command:
java -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=5555 -jar jmx_prometheus_httpserver/target/jmx_prometheus_httpserver-0.6-SNAPSHOT-jar-with-dependencies.jar 5556 config.yml

+ Run prometheus with the following prometheus.yml file:
scrape_configs:
- job_name: 'jmx'
scrape_interval: 5s
scrape_timeout: 10s
target_groups:
- targets: ['localhost:5556']

But when I go to the prometheus web console, and i check the "endpoint" localhost:5556/metrics i dont see anything about my jmx data (i see others metrics about Tomcat).

What I am missing??

Thanks in advance guys!
Greetings!

Brian Brazil

unread,
Jan 27, 2016, 9:36:12 AM1/27/16
to Daniel Lara, Prometheus Developers
If you're seeing Tomcat metrics from your application but not others, then something must be off on the spring side. Does spring do anything unusual in how it exposes things through JMX?

I'd generally recommend using the jmx exporter in agent mode, and looking at instrumenting your code directly with the java client.

Brian
 

What I am missing??

Thanks in advance guys!
Greetings!





--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

daniel.la...@gmail.com

unread,
Jan 28, 2016, 4:44:15 AM1/28/16
to Prometheus Developers, daniel.la...@gmail.com
Hi

I think I have found the error. It seems that the JMX metrics that Spring Boot exposed are not compatibles with Prometheus (https://github.com/prometheus/prometheus/issues/1190). I have tested to monitoring a cassandra docker container instead my app docker container and all is alright. So, what can I do to make Spring Boot JMX metrics compatibles with Prometheus?

Thanks!
Greetings!

Brian Brazil

unread,
Jan 28, 2016, 4:56:53 AM1/28/16
to Daniel Lara, Prometheus Developers
That says that Prometheus isn't directly compatible with Spring's metrics, which is why you need the JMX exporter.
 
I have tested to monitoring a cassandra docker container instead my app docker container and all is alright. So, what can I do to make Spring Boot JMX metrics compatibles with Prometheus?

If you can find some sample java code that can read the metrics via JMX, we should be able to figure out what's going on.

--

Daniel Lara

unread,
Jan 28, 2016, 5:09:22 AM1/28/16
to Brian Brazil, Prometheus Developers
With JConsole I can see all the JMX metrics from my docker container (including the Spring Boot Application), so I supose that the JMX "endpoint" is properly exposing the metrics.

Brian Brazil

unread,
Jan 28, 2016, 5:11:58 AM1/28/16
to Daniel Lara, Prometheus Developers
On 28 January 2016 at 10:09, Daniel Lara <daniel.la...@gmail.com> wrote:
With JConsole I can see all the JMX metrics from my docker container (including the Spring Boot Application), so I supose that the JMX "endpoint" is properly exposing the metrics.

If that were the case the jmx exporter would be picking it up, it must be doing something non-standard. If you can figure out what it's doing that's different, we can improve the jmx exporter to handle it.

Brian



--

bsus...@athenahealth.com

unread,
Nov 16, 2017, 3:07:17 AM11/16/17
to Prometheus Developers
Hey, did you find any java code example to integrate jmx exportor ?
Reply all
Reply to author
Forward
0 new messages