Twiddle support for interval and count parameters

JBoss 5 has a good command line monitoring tool, twiddle.sh, it can interact with JBoss jmx server to get attributes, invoke commands, etc.

The default behavior is to connect to JBoss, invoke the jmx command and exit. What if you setup a couple of monitoring attributes to read and saves to an external file ? User must create a bash script to loop the twiddle command into it, and creating a lot of connections during the monitoring.

I have modified twiddle source code to support an interval and count parameters, this allow the user to better control how much to interact with JBoss server, also it optimizes the connection behavior, where the twiddle gets one connection and works with it.

As I need only to read jmx attributes, I changed only the GetCommand.java, be aware that the way I changed the source code is not reusable between commands, as I didn’t want to spend too much time on this enhancement, this is enough for me.

You can grab my enhanced GetCommand.java, do a diff to see the modifications. Packaged is a custom build.sh script to compile and package the new GetCommand version. I didn’t use maven or build.xml scripts, as I do not want the full console or spend a lot of time downloading libraries, this simple build.sh is enough for me.

You can grab the twiddle source code (navigate the svn tree to find the correct AS version).

To run twiddle with the interval and count, use the jvm parameters as mentioned below, also you can use only the interval parameter to run continuously.

JAVA_OPTS="-Dtwiddle.interval=1 -Dtwiddle.count=5" ./twiddle.sh get <regular twiddle parameters>

 

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *