JMX Monitoring using jboss-cli

2.6k views Asked by At

We have an application which used JBoss 4.2.3.GA and we are migrating it to WildFly 8.2. In the old implementation, the JMX monitoring was done using twiddle. Since twiddle doesn't exist in WildFly, we are using the JBoss CLI for JMX monitoring.

Is it the right approach to use the JBoss CLI for JMX monitoring? Are there any command line tools similar to twiddle which can be used for JMX monitoring in WildFly?

1

There are 1 answers

2
Mike On

One option to get something similar would be to simply query the JMX MBeans programmatically yourself. The advantage here is that your solution can be reused without depending on things like Twiddle which may be discontinued and also are compatible with other app servers.

Here is an example using Groovy to query an MBean in Tomcat and here is an example using Java to query an MBean in ActiveMQ.

If you choose to go with Groovy, you should be aware that there is a way to use Groovy (or Javascript or Python) to wrap the CLI and have more of a control flow. The CLI is great for simple declarative things, but lacks the versatility of a proper scripting language.

If you want to use pure CLI, then that's fine too, but I would suggest you create files which you can then call through bash e.g.:

$JBOSS_HOME/bin/jboss-cli.sh -c --file="my-jvm-monitoring.cli"

You might find this CLI model reference useful and also this blog about monitoring WildFly with the CLI