To use, do the following to obtain usage:
% java -jar cmdline-jmxclient.jar
:
Usage: java -jar cmdline-jmxclient.jar USER:PASS HOST:PORT [BEAN] [COMMAND] Options: USER:PASS Username and password. Required. If none, pass '-'. E.g. 'controlRole:secret' HOST:PORT Hostname and port to connect to. Required. E.g. localhost:8081. Lists registered beans if only USER:PASS and this argument. BEAN Optional target bean name. If present we list available operations and attributes. COMMAND Optional operation to run or attribute to fetch. If none supplied, all operations and attributes are listed. Attributes begin with a capital letter: e.g. 'Status' or 'Started'. Operations do not. Operations can take arguments by adding an '=' followed by comma-delimited params. Pass multiple attributes/operations to run more than one per invocation. Use commands 'create' and 'destroy' to instantiate and unregister beans ('create' takes name of class). Pass 'Attributes' to get listing of all attributes and and their values. Requirements: JDK1.5.0. If connecting to a SUN 1.5.0 JDK JMX Agent, remote side must be started with system properties such as the following: -Dcom.sun.management.jmxremote.port=PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false The above will start the remote server with no password. See http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html for more on 'Monitoring and Management via JMX'. Client Use Examples: To list MBeans on a non-password protected remote agent: % java -jar cmdline-jmxclient-X.X.jar - localhost:8081 \ org.archive.crawler:name=Heritrix,type=Service To list attributes and attributes of the Heritrix MBean: % java -jar cmdline-jmxclient-X.X.jar - localhost:8081 \ org.archive.crawler:name=Heritrix,type=Service \ schedule=http://www.archive.org To set set logging level to FINE on a password protected JVM: % java -jar cmdline-jmxclient-X.X.jar controlRole:secret localhost:8081 \ java.util.logging:type=Logging \ setLoggerLevel=org.archive.crawler.Heritrix,FINE
This cmdline-jmxclient can be used to connect to the SUN JVM JDK 1.5.0 JMX Agent to set logging levels remotely and to get information on the running JVM. It can also be used to remotely control Heritrix (Heritrix starts the SUN JVM JDK 1.5.0 JMX Agent when its run under SUN JDK 1.5.0 and then attaches Management Beans for control and monitoring). This command-client can probably be gotten to talk to other JMX Agents but its only been tried against the JDK JMX Agent.