Getting Started with the Java Dynamic Management Kit 4.2

Instrumenting Resources

MBeans conform to the JMX specification, which standardizes the representation of the MBean's management interface. Therefore, the first step of the development process is to define the management interface of your resources.

If you are creating new resources, you must determine the granularity of the information about that resource. "How many attributes need to be exposed for management? What operations will be useful when the resource is deployed? When should the resource send notifications?" These are all questions whose answers determine the granularity of your MBean's management interface.

Consider an MBean representing a printer. If your MBean will be exposed to end users, it may only need to expose a state attribute, "ready" or "offline", and perhaps an operation such as "switch paper trays." However, if your MBean is intended to allow remote servicing, it will need to contain much more information. Operators will probably need to know the total print count, the toner level, the location of a paper jam, and they may want to run self-diagnostics.

Sometimes, resources are already manageable through some other system. In this case, you only need to translate their existing management interfaces into an MBean. Because the JMX architecture is so rich, you can usually improve upon the existing management interface in the translation. Some operations may not be needed because they can be replaced by an agent service. New attributes might be added now that they can be computed dynamically.

As more vendors adopt the JMX specification, resources will be supplied with their instrumentation. Your task will then be to understand the management interface that is provided and to integrate the MBean classes into your application. In this case you will be integrating MBeans from various sources and insuring that they interact as expected.