Live Monitoring Using the JMX Interface

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

JMX (Java Management Extensions API) allows you to monitor the status of your Confluence instance in real time. JMX uses objects called MBeans (Managed Beans) to expose data and resources from your application, providing useful data such as the resource usage of your instance and its database latency, allowing you to diagnose problems or performance issues.

In this page we'll guide you through how to use JConsole to monitor Confluence locally and remotely. JConsole is included in the Java Development Kit (JDK), but you can use any JMX client.

This guide provides a basic introduction to the JMX interface and is provided as is. Our support team can help you troubleshoot a specific Confluence problem, but aren't able to help you set up your monitoring system or interpret the results.

Monitor Confluence using JMX

Monitor Confluence remotely using your APM

To monitor Confluence in your Application Performance Monitoring (APM) tool, you'll need to install a JMX exporter to transform theJMX MBeans into the right format for your tool. See Monitor application performance to find out how to do this. 

If you don't have an Application Performance Monitoring (APM) system, we've created a guide to get you started with Prometheus and Grafana, including some template dashboards that you can use as a jumping off point. See Monitor Confluence with Prometheus and Grafana.

Monitor Confluence remotely using JConsole

Remote monitoring is recommended for production systems, as it does not consume resources on your Confluence server.

To monitor remotely:

  1. Add the following properties to your setenv.sh / setenv.bat file. The port can be any port that is not in use.

    set CATALINA_OPTS=-Dcom.sun.management.jmxremote %CATALINA_OPTS%
    set CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=8099 %CATALINA_OPTS%
  2. Decide how you will secure your remote connection. See Remote Monitoring and Management for more information. 
    Although it is possible to disable authentication, we do not recommend doing this on a production system.

  3. Start JConsole (you'll find it in the bin directory of the JDK installation directory).
  4. Select Remote Process.
  5. Enter your hostname and port (this is the port you specified earlier, not the Confluence port).
  6. Click Connect.

See Using JConsole for more information on remote monitoring.

Monitor Confluence locally using JConsole

If you are troubleshooting a particular issue, or only need to monitor Confluence for a short time, you can use local monitoring. Local monitoring can have a performance impact on your server, so its not recommended for long term monitoring of your production system.

To monitor locally:

  1. Start JConsole (you'll find it in the bin directory of the JDK installation directory)

  2. Select Local Process.
  3. Select the Confluence process. It will be called something like org.apache.catalina.startup.Bootstrap start

See Using JConsole for more information on local monitoring.

Write JMX metrics to a log file

You can also choose to write the following JMX metrics to a log file. This is useful when you are troubleshooting a problem.

  • CacheStatistics
  • IndexingStatistics
  • MailTaskQueue
  • RequestMetrics
  • SystemInformation
  • ThreadPool
  • OS
  • GC
  • Threading
  • TomcatManager
  • RequestProcessor

To write JMX metrics to a log file:

  1. Go to Administration  > General Configuration > Scheduled jobs
  2. Enable the Log JMX Metrics job. 

This job runs once per minute by default, and writes metrics to the <local-home/logs/atlassian-confluence-jmx.log file. 

Disable JMX monitoring

To diable JMX monitoring:

  1. Go to Administration  > General Configuration > Monitoring.
  2. Deselect JMX monitoring.

This will also disable App monitoring, as it requires JMX to be enabled. 

Confluence MBeans

You can use the following Confluence MBeans to see live information about your Confluence instance.

CacheStatistics

This MBean shows information about Confluence caches. This info can also be found on the Cache Statistics page.

IndexingStatistics

This MBean shows information related to search indexing. Here's some useful attributes.

Property name

Function

Values

Flushing

Indicate whether the cache is currently flushing

True/False

LastElapsedMilliseconds

Time taken during last indexing

Milliseconds

TaskQueueLength

Shows number of tasks in the queue

Integer

ReIndexing Indicates whether Confluence is currently reindexingTrue/False

SystemInformation

This MBean shows information such as the Confluence version and uptime. This info can also be found on the System Information page.  

Property name

Function

Values

DatabaseExampleLatency

Shows the latency of an example query performed against the database

Milliseconds

RequestMetrics

This MBean shows information related to system load and error pages served.

Property name

Function

Values

AverageExecutionTimeForLastTenRequests

Average execution time for the last ten requests.

Milliseconds

CurrentNumberOfRequestsBeingServed

Number of requests being served at this instant.

Integer

ErrorCount

Number of times the Confluence error page was served.

Integer

NumberOfRequestsInLastTenSeconds

The number of requests in the last ten seconds.

Integer

MailServer-SMTPServer

This MBean shows information related to email dispatch attempts and failures. There will be an MBean for every SMTP Mailserver that has been configured in the Confluence instance.

Property name

Function

Values

EmailsAttempted

The number of email messages Confluence has tried to send.

Integer

EmailsSent

The number of email messages sent successfully.

Integer

MailTaskQueue

This MBean shows information related to the email workload.

Property name

Function

Values

ErrorQueueSize

Number of errors in the queue.

Integer

Flushing

Shows state (i.e. flushing, or not)

True/False

FlushStarted

Time that operation began.

Time

RetryCount

The number of retries that were performed.

Integer

TaskSize

Number of email messages queued for dispatch.

Integer

SchedulingStatistics

This MBean shows information related to current jobs, scheduled tasks and the time that they were last run.

Property nameFunctionValues
AllJobNamesShows information on current scheduled jobs including the time they were last runString
CurrentlyRunningJobNamesLists the scheduled jobs that are currently runningList

App-specific metrics

Enable app monitoring to expose additional metrics that are useful when troubleshooting issues with Marketplace and custom-built apps. 

See App metrics reference for a full list of app-specific metrics.

Additional MBeans

To also monitor Hibernate and Hazelcast (Confluence Data Center only) you will need to add the following properties to your setenv.sh / setenv.bat file first. 

set CATALINA_OPTS=-Dconfluence.hazelcast.jmx.enable=true %CATALINA_OPTS%
set CATALINA_OPTS=-Dconfluence.hibernate.jmx.enable=true %CATALINA_OPTS%

This will make the Hibernate and Hazelcast MBeans available in your JMX client. 

Monitoring high CPU consuming threads

The Top Threads Plugin for JConsole is useful for monitoring whether the CPU is spiking. Use the following command to start JConsole with this plugin:

JConsole -pluginpath /pathto/topthreads.jar
Last modified on Jul 29, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.