Wednesday, May 27, 2009

Scripting JMX via JRuby

I'm gradually growing some operations scripts which use JMX to alter application behaviour according to system load / required maintenance, etc. JRuby is a nice easy way to create these scripts.

host = 'some-ip'
port = 'port-number'
serviceUrl ="service:jmx:rmi:///jndi/rmi://#{host}:#{port}/jmxrmi")
connector =
remote = connector.getMBeanServerConnection()
remoteRuntime =,,
p remoteRuntime.getName()

No comments: