How to get JMX data from Confluence using jmxterm

Still need help?

The Atlassian Community is here for you.

Ask the community


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.


  1. 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



  2. Determine the Confluence PID.

    ps -ef | grep -i java



  3. 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: Usage

    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

Jmxterm

Live Monitoring Using the JMX Interface

Oracle - Java Management Extensions (JMX)

Oracle - Using JConsole


Last modified on Apr 27, 2020

Was this helpful?

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