How to get JMX data from Confluence using jmxterm
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.1
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.
1
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: Usage1 2 3
echo 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
Was this helpful?