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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: