0

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?

Qiu
  • 5,651
  • 10
  • 49
  • 56
Sunayana
  • 13
  • 1
  • 6
  • Do you want live monitoring only or something which will do historical monitoring? E.g. something you can wrap in a bash script and pipe to a file every 2 or 5 minutes? – Mike Jun 11 '15 at 11:26

1 Answers1

0

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

Konstantin
  • 3,626
  • 2
  • 33
  • 45
Mike
  • 4,852
  • 1
  • 29
  • 48
  • I chose to go with Groovy and followed the https://developer.jboss.org/wiki/AdvancedCLIScriptingWithGroovyRhinoJythonEtc link. I copied the code into uptime.groovy file and started wildfly server using standalone.sh present in bin folder. But iam getting error as follows 2: unable to resolve class org.jboss.as.cli.CommandContext @ line 2, column 1. import org.jboss.as.cli.CommandContext ^ 1 error – Sunayana Jun 11 '15 at 12:30
  • Did you make sure to add the CLI remote client jar to the classpath? E.g. `groovy -cp jboss-cli-client.jar uptime.groovy` – Mike Jun 11 '15 at 12:51