vladimirvivien / jmx-cli Goto Github PK
View Code? Open in Web Editor NEW[Project Inactive] Jmx-Cli is a command-line interface console for JMX
[Project Inactive] Jmx-Cli is a command-line interface console for JMX
Jmx-Cli ------- Jmx-Cli is a command-line interface console for JMX. It is developed using the Clamshell-Cli framework (http://code.google.com/p/clamshell-cli/). Installation ------------ 1. Download the current distribution from https://github.com/vladimirvivien/jmx-cli/downloads. 2. Unzip at the location of your choosing (jmx-cli-home). 3. Cd to jmx-cli-home 4. From the command prompt, type > java -jar cli.jar If all works ok, you should see: /##### /###### /## /## |__ ## /##__ ## | ## |__/ | ## /######/#### /## /## | ## \__/ | ## /## | ## | ##_ ##_ ## | ## /##/ | ## | ## | ## /## | ## | ## \ ## \ ## \ ####/ | ## | ## | ## | ## | ## | ## | ## | ## >## ## | ## ## | ## | ## | ######/ | ## | ## | ## /##/\ ## | ######/ | ## | ## \______/ |__/ |__/ |__/ |__/ \__/ \______/ |__/ |__/ A command-line tool for JMX Powered by Clamshell-Cli framework http://code.google.com/p/clamshell-cli/ Getting Started --------------- Using Jmx-Cli is straight forward. From the prompt type 'help' to get a list of available commands: exit Exits ClamShell. help Displays help information for available commands. ps Displays a list of running JVM processes (similar to jps tool) connect Connects to local or remote JVM MBean server. mbean Creates a label for identifying an MBean desc Prints description for specified mbean. list Lists JMX MBeans. exec Execute MBean operations and getter/setter attributes. Command Hints ------------- You can also get command hints from the prompt by pressing on the tab key. This will list all available combinations of input. You can narrow down the hints by typing a few letters of the command then press tab. Connecting to JVM ----------------- To connect to a running local JVM, do the followings: 1. Use the 'ps' command to get a list of JMV processes running locally: > ps 1444 cli.jar 1740 org.apache.catalina.startup.Bootstrap 2. use the 'connect' command to attach to a running process > connect pid:1740 The sequence above connects to a running instance of Tomcat server. Listing MBeans -------------- Once connected to a JVM, you can query available MBeans that are running in that JVM. Use the 'list' command to retrieve lists of MBeans. > list filter:"Catalina:*" The command above will list all MBeans running in the "Catalina" domain. You can label the list for future reference by typing: > list filter:"Catalina:*" label:true MBean list [Catalina:*] [$0] Catalina:type=Server [$1] Catalina:realmPath=/realm0/realm0,type=Realm ... Describing an MBean ------------------- Once you have a list, you can select a bean to describe. The following describes bean with label 'Catalina:port=8080,type=Connector': > desc bean:"Catalina:port=8080,type=Connector" MBean: Catalina:port=8080,type=Connector (org.apache.catalina.mbeans.ConnectorMBean) Implementation of a Coyote connector Attributes: port : int (rw) - The port number on which we listen for requests useIPVHosts : boolean (rw) - Should IP-based virtual hosting be used? redirectPort : int (rw) - The redirect port for non-SSL to SSL redirects minSpareThreads : int (rw) - The number of request processing threads that will be created secure : boolean (rw) - Is this a secure (SSL) Connector? acceptCount : int (rw) - The accept count for this Connector maxThreads : int (rw) - The maximum number of request processing threads to be created URIEncoding : java.lang.String (rw) - Character encoding used to decode the URI modelerType : java.lang.String (r) - Type of the modeled resource. Can be set only once packetSize : int (rw) - The ajp packet size. processorCache : int (rw) - The processor cache size. ... xpoweredBy : boolean (rw) - Is generation of X-Powered-By response header enabled/disabled? stateName : java.lang.String (r) - The name of the LifecycleState that this component is currently in allowTrace : boolean (rw) - Allow disabling TRACE method useBodyEncodingForURI : boolean (rw) - Should the body encoding be used for URI query parameters secret : java.lang.String (w) - Authentication secret (I guess ... not in Javadocs) Operations: destroy():void pause():void stop():void resume():void start():void init():void The same command can be issued using the associated label of the bean from the list (see above): > desc bean:$28 Execute an Operation -------------------- Jmx-cli lets you execute operation on your management beans as well. The next examples shuts down the Tomcat connector for port 8080: > exec bean:"Catalina:port=8080,type=Connector" op:"stop" Known Issues ------------ 1. 64-bit Windows not compatible with current jline library. 2. Some of the commands do not work in Jdk7 (i.e. ps command.)
When running on JDK7, several commands (including ps and connect) cause the following error:
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
at org.clamshellcli.jmx.Management.getHostIdentifier(Management.java:83)
at org.clamshellcli.jmx.Management.mapVmInfo(Management.java:113)
at org.clamshellcli.jmx.PsCommand.execute(PsCommand.java:88)
at org.clamshellcli.jmx.JmxController.handle(JmxController.java:81)
at org.clamshellcli.impl.CliConsole$1.run(CliConsole.java:150)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
It is not possible to get values of attributes that contain blank characters.
Example:
jmx-cli > exec bean:"com.dr.wf:component=Tree,type=Workflow,workflow=example" get:"Agent name"
javax.management.AttributeNotFoundException: Agent,name
The space is always replaced with comma.
Thanks!
A command-line tool for JMX
Powered by Clamshell-Cli framework
http://code.google.com/p/clamshell-cli/
Java version: 1.8.0_77
OS: Linux, Version: 3.10.0-229.14.1.el7.x86_64
jmx-cli > ps
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: sun/jvmstat/monitor/HostIdentifier
at org.clamshellcli.jmx.Management.getHostIdentifier(Management.java:83)
at org.clamshellcli.jmx.Management.mapVmInfo(Management.java:113)
at org.clamshellcli.jmx.PsCommand.execute(PsCommand.java:88)
at org.clamshellcli.jmx.JmxController.handle(JmxController.java:81)
at org.clamshellcli.impl.CliConsole$1.run(CliConsole.java:150)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: sun.jvmstat.monitor.HostIdentifier
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
Hi,
I just cloned the current sources and can't build using Maven.
INFO] ------------------------------------------------------------------------
[INFO] Building jmx-cli 0.1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.clamshellcli:clamshell-api:jar:0.5.1 is missing, no dependency information available
[WARNING] The POM for org.clamshellcli:clamshell-impl-core:jar:0.5.1 is missing, no dependency information available
Downloading: http://maven.seometrie.dev/content/groups/public/org/clamshellcli/clamshell-test/0.5.1/clamshell-test-0.5.1.pom
[WARNING] The POM for org.clamshellcli:clamshell-test:jar:0.5.1 is missing, no dependency information available
Downloading: http://maven.seometrie.dev/content/groups/public/org/clamshellcli/clamshell-test/0.5.1/clamshell-test-0.5.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.088s
[INFO] Finished at: Fri Jun 22 14:26:49 CEST 2012
[INFO] Final Memory: 8M/131M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project jmx-cli: Could not resolve dependencies for project org.clamshellcli.jmx:jmx-cli:jar:0.1.0: The following artifacts could not be resolved: org.clamshellcli:clamshell-api:jar:0.5.1, org.clamshellcli:clamshell-impl-core:jar:0.5.1, org.clamshellcli:clamshell-test:jar:0.5.1: Failure to find org.clamshellcli:clamshell-api:jar:0.5.1 in http://maven.seometrie.dev/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
[ERROR]
This also fails with version 0.5.1
Can the output of one command be used as the input to another, similar to how pipelines function in Bash or PowerShell?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.