Enable JMX monitoring for remote Bitbucket Server/Data Center

If you want to know how JVM performs for your remote Bitbucket Server/Data Center you can either install an app for it ( for example, Prometheus Exporter for Bitbucket) or you can open JMX monitoring on your Bitbucket side and connect to its JVM with Jconsole, VisualVM or any other tool like this.

In this article I will show you how to open JMX for monitoring in your remote Bitbucket Server/Data Center.

First of all, open BITBUCKET_HOME/shared/bitbucket.properties and add the following line:

jmx.enabled=true

Then create jmx.access file in any folder you like with the following line:

monitorRole <password>

Make sure that this file is readable for the user under whom you start Bitbucket.

chown yourbitbucketuser jmx.access

Change permissions for the file with the following command:

chmod 600 jmx.access

Then open BITBUCKET_INSTALLATION/bin/set-jmx-opts.sh file and add the following lines:

MX_REMOTE_AUTH=password
JMX_REMOTE_PORT=9999 (this port you provide during connection to JMX)
RMI_SERVER_HOSTNAME=your.bitbucket.dns (ip is also valid)
JMX_PASSWORD_FILE=<path>/jmx.access
JMX_REMOTE_RMI_PORT=9998 (if you do not provide this parameter then JMX will choose a random port but it will not work if you open only certain ports on your server)

Now restart your Bitbucket instance and try to connect. I will connect with JConsole:

After it you will connect to JVM and will be able to see all the information:

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Leave a Reply

%d bloggers like this:

Spelling error report

The following text will be sent to our editors: