Module: JMX
- Defined in:
- lib/jmx.rb,
lib/jmx/mbeans.rb,
lib/jmx/server.rb,
lib/jmx/version.rb,
lib/jmx/notifier.rb,
lib/jmx/mbean_proxy.rb,
lib/jmx/dynamic_mbean.rb,
lib/jmx/util/string_utils.rb
Defined Under Namespace
Modules: JavaTypeAware, MBeans, RubyNotificationEmitter, StringUtils Classes: Attribute, MBeanProxy, MBeanServer, MBeanServerConnector, NoSuchBeanError, Operation, Parameter
Constant Summary collapse
- VERSION =
"1.1"
Class Method Summary collapse
-
.connect(opts = {}) ⇒ Object
Connect to a MBeanServer opts can contain several values :host - The hostname where the server resides (def: localhost) :port - Which port the server resides at (def: 8686) :url_path - path part of JMXServerURL (def: /jmxrmi) :user - User to connect as (optional) :password - Password for user (optional).
-
.simple_server(opts = {}) ⇒ Object
sad little simple server setup so you can connect up to it.
Class Method Details
.connect(opts = {}) ⇒ Object
Connect to a MBeanServer opts can contain several values
:host - The hostname where the server resides (def: localhost)
:port - Which port the server resides at (def: 8686)
:url_path - path part of JMXServerURL (def: /jmxrmi)
:user - User to connect as (optional)
:password - Password for user (optional)
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jmx.rb', line 20 def self.connect(opts = {}) host = opts[:host] || 'localhost' port = opts[:port] || 8686 url_path = opts[:url_path] || "/jmxrmi" url = "service:jmx:rmi:///jndi/rmi://#{host}:#{port}#{url_path}" if opts[:user] JMX::MBeanServer.new url, opts[:user], opts[:password] else JMX::MBeanServer.new url end end |
.simple_server(opts = {}) ⇒ Object
sad little simple server setup so you can connect up to it.
36 37 38 39 40 41 42 43 |
# File 'lib/jmx.rb', line 36 def self.simple_server(opts = {}) port = opts[:port] || 8686 url_path = opts[:url_path] || "/jmxrmi" server = opts[:server] || JMX::MBeanServer.new url = "service:jmx:rmi:///jndi/rmi://localhost:#{port}#{url_path}" $registry = opts[:registry] || RMIRegistry.new(port) @connector = JMX::MBeanServerConnector.new(url, JMX::MBeanServer.new).start end |