How to get JMX data from Confluence using jmxterm
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Java Management Extensions (JMX) is useful to get runtime monitoring data of exposed mbeans.
Jmxterm is
... an open source command line based interactive JMX client written in Java.
It lets user access a Java MBean server in command line console without graphical environment.
In another word, it's a command line alternative of jconsole. JMXTerm relies on jconsole library at runtime though.
Using jmxterm is useful to quickly grab JMX data without the need to open a tool similar to jconsole, which requires a GUI.
Solution
The example below shows how to gather a specific data from a running Confluence instance. This can be used for any Java application, such as Jira.
If you don't have the
jmxterm .jar
file in the Confluence server, download it.curl -L -o jmxterm-1.0.1-uber.jar https://github.com/jiaqi/jmxterm/releases/download/v1.0.1/jmxterm-1.0.1-uber.jar
Determine the Confluence PID.
ps -ef | grep -i java
Run the following command to extract the value of a MBean.
In this example we are targeting the following attributes:
- MBean domain:java.lang
- MBean name:Code Cache
– spaces must be escaped with\\
- MBean attribute: Usageecho get -s -d java.lang -b java.lang:name=Code\\ Cache,type=MemoryPool Usage | \ java -jar jmxterm-1.0.1-uber.jar \ -l <Confluence PID> -n
Related Content
Live Monitoring Using the JMX Interface
Oracle - Java Management Extensions (JMX)