Last active
December 5, 2015 08:01
-
-
Save FilBot3/5998987c12369f6ad669 to your computer and use it in GitHub Desktop.
jmx4r example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CMD="get -b java.lang:type=Memory HeapMemoryUsage" | |
| echo $CMD | java -jar jmxterm-1.0-alpha-4-uber.jar -l localhost:1099 -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # | |
| # https://github.com/jmesnil/jmx4r | |
| # This script can only be ran with JRuby | |
| # | |
| require 'rubygems' | |
| require 'jmx4r' | |
| JMX::MBean.establish_connection :host => "localhost", :port => "1099" | |
| memory = JMX::MBean.find_by_name "java.lang:type=Memory" | |
| puts memory.heap_memory_usage['used'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment