[update: fixed Ruby script by using ManagementFactory::newPlatformMXBeanProxy instead of MBeanServerInvocationHandler::newProxyInstance based on Daniel comment]
I needed to write a script to automate the management of a Java application using JMX which I could put in a crontab.
I found some explanation on how to script JMX in jconsole with BeanShell or with Groovy. It’s a good approach but:
- I want the scripts to be executable in a cron (and not from jconsole GUI)
- I’d prefer to write them in Ruby
It turns out that it is straightforward to write such scripts using JRuby and Java 5 or later. (more…)
