Monday, 4 January 2010

Managing the Byteman Agent using RHQ

John Mazzitelli is a Red Hat developer working on the RHQ management platform and its downstream projects such as Jopr and JBoss Operations Network. RHQ is a powerful tool which enables integrated systems monitoring and management for a range of different products on a broad range of platforms. It provides a console interface from which it is possible to display the current or historical state of multiple managed applications as well as start/stop them, adjust their configuration and otherwise control their operation.

RHQ's architecture is plug-in based which means that it is relatively easy to extend RHQ to manage new applications. John used that capability to build me a nice little Christmas present, a Byteman-aware plug-in for RHQ. The plug-in automatically detects Java apps which have been started with the Byteman agent listener enabled. It provides a neat GUI interface allowing you to view the agent state. You can see which rules have been loaded and whether they have been successfully parsed and injected into loaded classes. You can identify jars which have been added to the classpath by the agent. You can also upload new rules or delete currently installed rules on the fly. The plug-in organises all this information in a simple, clear tree-based display with nifty point and click controls.

John's blog describes what he has done in more detail. It also links to a demo which shows him using the Byteman RHQ plug-in to drive an agent running inside JBoss App Server. John uses the plug-in to install some rules and helper class libraries into the App Server, obtain the trace output he is interested in and then uninstall the rules. The rules themselves trace the execution of servlet code by counting servlet requests and computing average timing, writing the resulting statistics to the JBoss console. John uses the JBoss RHQ plug-in to filter the console output, presenting the trace in its own display window.

Thank you, John. It sure beats the pair of socks I got last year.