Currently using JMX (through the wsadmin utility in WAS) to call JMX MBeans to query runtime state but it's too expensive to do frequently. Starting wsadmin takes too much CPU and it just takes too long to get the data.
My current workaround is to deploy a servlet to the server and the servlet does the JMX query or other commands against the MBean. The servlet parameters provide the necessary data for what I want to do.
I then use a perl script with the perl http client to invoke the servlet and get the answer. This is signficantly more efficient than using wsadmin for these scenarios. Typically takes well under a second to get the data versus 15-30 seconds using wsadmin, best case. I'll see if I can publish the code, it's pretty straightforward to write the servlet and the perl script is also simple.
Worth remembering if you need to do this sort of checking frequently, probably applies to everyones application server and not just WebSphere also. A perl script simply starts a hell of a lot faster than a JVM.
Another option is this nifty bit of work called NailGun: http://www.martiansoftware.com/nailgun/
It is intended as a solution to slow JVM startup so you can write quick command line utilities in Java, but it would work in this instance too.
Posted by: Nicholas | January 11, 2005 at 11:39 AM
Thanks for the great post. Can you post the servlet and perl script you used?
Thanks in advance!
Posted by: earl_the_perl | February 15, 2005 at 11:46 AM
Hi Thanks for the post can you please upload the servlet and the perl script
Posted by: Venkat | April 16, 2008 at 03:33 PM
Hi Thanks for the post can you please upload the servlet and the perl script
Posted by: Venkat | April 16, 2008 at 03:34 PM
Can you please post the code?
Posted by: ganesh | November 13, 2008 at 11:25 PM
Can you please post the code?
Posted by: Sandy | February 19, 2009 at 02:12 AM
To those folks who wanted to know how this is being done, I created an example on my blog:
http://alvinabad.wordpress.com/2009/02/15/automating-websphere-using-jmx/
Posted by: Alvin Abad | March 02, 2009 at 03:48 AM
"jmx4perl" is using a similar approach, which was tested with a bunch of JEE Server. For Websphere, I have reports that it works with WAS 6.1 and 7.0, unfortunately due to the lack of a testing environment, I cant test it on my own.
You might want to have a look at http://search.cpan.org/~roland/jmx4perl/ for further information.
Beside a programming model for this 'agent based approach' (via perl modules) it provides a command line perl tool 'jmx4perl' and a Nagios plugin 'check_jmx4perl' out of the box.
Sorry for the plug, but I though, it might be of some interest here ... ;-)
Posted by: roland | June 07, 2009 at 12:28 PM