Monitoring MBeans


What's the big deal with MBeans? Why are they interesting? MBeans provide a standardized form of metadata that management clients can use to inspect the state of the server. These self-describing services make it easy to write management applications, such as the Web Console, that can manage services regardless of their type.

In this environment, a management application can perform its actions on arbitrary services. It can monitor free memory in the system as easily as it can watch your connection pool size, and it can monitor services inside your application as easily as it monitors the JBoss-provided services.

With that in mind, we'll look at the ability to monitor a service, live, in JBoss.

How do I do that?

One of the things that can be valuable to watch in JBoss is the amount of free memory available to you. To do that, find the jboss.system:type=ServerInfo MBean in the navigation panel. Once you are there, expand the ServerInfo MBean so that you can see all the attributes. Right-click the FreeMemory attribute, and then bring up the context-sensitive menu, as shown in Figure 8-4.

Developer's Notebook 8-4. Free Memory graph menu


Choose the Graph menu item. JBoss will begin graphing the amount of free memory over time. If you leave it open for a while, you should see a graph that looks like Figure 8-5, showing free memory growing and shrinking as you go through the normal Java garbage-collection cycles.

You can right-click the graph to change its look, and even save or print the current view.

What just happened?

You saw how to get a live chart of the free memory in the JBoss application server. Although the charts themselves are somewhat limited, they are easy to set up. If you are trying to monitor a queue or connection pool size, it is easy to watch the response of the desired metric as you are accessing the application.


Note: If you exposed parts of your application through MBeans, you can easily monitor application-specific values.

Developer's Notebook 8-5. Free Memory graph




JBoss. A Developer's Notebook
JBoss: A Developers Notebook
ISBN: 0596100078
EAN: 2147483647
Year: 2003
Pages: 106

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net