Monitoring JBoss AS start with JMX

Friday, September 3rd, 2010 | Java, Tech-savvy

Today a fellow colleague asked for a better way to check whether an app server is really up and running than grepping the log file. Well, for we are using a JEE compliant server (JBoss) I suggested looking into JMX for it is the designated monitoring interface, right? Unfortunately I didn’t get replied to even after suggesting it twice. Whatever, apart from proving brilliant communication skills I may have missed something that didn’t make JMX an option (like a firewall issue or something).

Still, I wanted to look into it anyway, because it seemed a fun and pretty simple task to write a little JMX client that probes the desired MBean. But it is even easier. JBoss offers a little helper out of the box that is up to the task in no time. It’s a little tool called twiddle. Usage is self explanatory:

A JMX client to 'twiddle' with a remote JBoss server.
 
usage: twiddle [options] <command> [command_arguments]
 
options:
    -h, --help                Show this help message
        --help-commands       Show a list of commands
    -H=<command>              Show command specific help
    -c=command.properties     Specify the command.properties file to use
    -D<name>[=<value>]        Set a system property
    --                        Stop processing options
    -s, --server=<url>        The JNDI URL of the remote server
    -a, --adapter=<name>      The JNDI name of the RMI adapter to use
    -u, --user=<name>         Specify the username for authentication
    -p, --password=<name>     Specify the password for authentication
    -q, --quiet               Be somewhat more quiet

Now you only have to decide which MBean to probe. As “are u there” is one of the most basic thinks to ask for this isn’t too hard either:

twiddle.sh get jboss.system:type=Server Started

As soon as this returns true the server is up and running.

So, just put this command in your shell script and you can easily probe your JBoss AS if it is ready to go app serving.

Tags: , , ,

2 Comments to Monitoring JBoss AS start with JMX

Rob
3. September 2010

Greatness. :)

Fabian Lange
3. September 2010

I heard you saying JMX only once. And I guess I ignored you because Carsten spoke louder at that moment.

But you know, I prefer technically superior solutions. So lets go for it :)

Leave a comment

Search

Categories