jmx.sh

Interactive command-line JMX client for monitoring and managing Java applications.

Quick Start

Homebrew

Install on macOS or Linux with Homebrew:

brew install nyg/jmxsh/jmxsh

JAR

Download the latest JAR from Releases and run:

java -jar jmxsh-<version>.jar

Debian/Ubuntu

Add the repository and install:

# Import the GPG key
curl -fsSL https://jmx.sh/apt/gpg.asc | sudo gpg --dearmor -o /usr/share/keyrings/jmxsh.gpg

# Add the repository
sudo tee /etc/apt/sources.list.d/jmxsh.sources << 'EOF'
Types: deb
URIs: https://jmx.sh/apt
Suites: stable
Components: main
Signed-By: /usr/share/keyrings/jmxsh.gpg
EOF

# Install
sudo apt update && sudo apt install jmxsh

Interactive Mode

Connect to any JMX-enabled JVM and explore MBeans interactively with tab completion and command history.

jmxsh
$ jmxsh
Welcome to jmx.sh, type "help" for available commands.
> open localhost:9999
Connection to localhost:9999 is opened.
> domains
The following domains are available:
JMImplementation
java.lang
com.example
> bean com.example:type=AppStats
Bean is set to com.example:type=AppStats.
> get RequestCount
MBean = com.example:type=AppStats:
RequestCount = 42;
> run resetStats
Calling operation resetStats of mbean com.example:type=AppStats with params [].
Operation returns:
null
> close
Disconnected.
> quit
Bye.

Non-Interactive Mode

Automate JMX operations with scripts and pipes — perfect for monitoring, alerting, and CI/CD pipelines.

Script File

Run commands from a file:

jmxsh -l localhost:9999 --input commands.txt

Piped Input

Pipe commands via stdin:

echo "open localhost:9999 && beans" | jmxsh -n

Commands

Command Description
open <host:port>Connect to a remote JMX endpoint (RMI)
open jmxmp://<host:port>Connect to a remote JMX endpoint (JMXMP)
open <pid>Attach to a local JVM by process ID
domainsList all MBean domains
domain [name]Show or set the current domain
beansList all MBeans (filter by domain with -d)
bean <name>Select an MBean for subsequent operations
infoShow attributes and operations of the selected MBean
get <attr>Read an MBean attribute
set <attr> <value>Write an MBean attribute
run <op> [args]Invoke an MBean operation
watch <attr>Poll an MBean attribute and print its value continuously
subscribeSubscribe to the notifications of an MBean
unsubscribeUnsubscribe from the notifications of an MBean
closeDisconnect from the JMX endpoint
alias <name> [target]Define, show or list connection aliases
unalias <name>Remove a connection alias
jvmsList local Java processes
helpShow all available commands
quitExit jmxsh (also exit or bye)

Features

⌨️

Interactive REPL

Tab completion and command history powered by JLine.

🔌

Remote & Local

Connect via host:port (RMI), jmxmp:// (JMXMP), JMX URL, or local PID.

📦

Full MBean Support

Browse domains, read/write attributes, invoke operations.

📈

Live Monitoring

Watch attribute values with watch, receive MBean notifications with subscribe.

🔖

Connection Aliases

Name your frequent connection targets and reuse them in open or -l.

💬

Configurable Prompt

Show the connected server, domain and bean in the prompt via a simple template.

⛓️

Command Chaining

Run multiple commands in one line with &&.

📜

Scripting-Friendly

Automate via files or piped input; quiet mode (-q) keeps output clean.

📂

XDG Compliant

Follows the XDG Base Directory spec — keeps your home directory clean.