SonarQube JMX exporter: Is it possible to use all MBeans at once?

Must-share information:

  • which versions are you using: SonarQube 10.6.0-enterprise
  • how is SonarQube deployed: Docker
  • what are you trying to achieve: I’m trying to fetch all MBean metrics at the same time.
  • what have you tried so far to achieve this: I was able to fetch either one of these, using jmx_prometheus_httpserver.

Am I missing something, or does it seem like I can only scrape from one MBean, since I cannot provide more than one hostPort or jmxUrl? I start the httpserver version with java -jar /opt/sonarqube/jmx_prometheus_httpserver.jar 0.0.0.0:{JMX_PORT} config.yaml, and the config.yaml contains hostPort as a string, with rules to capture everything.

Hi,

It’s not clear to me why you think the port and URL are tied to a single metric.

 
Ann

This documentation suggests me that I need to define different ports for each MBean, setting sonar.web.javaAdditionalOpts, sonar.ce.javaOpts and sonar.search.javaAdditionalOpts.

Thus I end up with three different ports for each remotejmx options, but only one JMX exporter port exposed. Somehow, jmxhttpserver only uses one of these, since I cannot provide more than one hostPort or jmxUrl, and I cannot run more than one JMX exporter since this is discouraged.

What am I missing in this implementation? I need to find a solution, or understand why it works the way it works.

Another issue: I am unable to get any metric from SonarQube MBean either.

Hi @murat

The SonarQube runs three processes: compute engine, web process and elasticsearch. Only first two expose custom MBeans that you can read about in the documentation. You are free to try to connect to elasticsearch process to access its MBeans however from what I see it only exposes basic Java related MBeans. Please note that connecting to elasticsearch MBeans is not documented in our docs.

Because we have two processes we need to naturally expose two JMX ports, there is no way around it. Each Java process has its own MBeans and they can’t share the same port.

If the tool of your choice supports connecting to only one port at once then there is nothing we can do (apart from simply running the tool twice).

2 Likes

Hi @Lukasz_Jarocki, I’ll check different tools in this case. If I find a good one, I’ll edit this reply.
Thanks for the explanation!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.