JMX

21
JMX David Moran [email protected] 10/20/03

description

JMX. David Moran [email protected] 10/20/03. Agenda. Overview Managed Beans Services Remote API J2EE Management Implementations Future Directions Demo. Benefits. JMX is an API to for managing java applications. - PowerPoint PPT Presentation

Transcript of JMX

Page 1: JMX

JMX

David Moran

[email protected]

10/20/03

Page 2: JMX

Agenda

OverviewManaged BeansServicesRemote APIJ2EE ManagementImplementationsFuture DirectionsDemo

Page 3: JMX

Benefits

JMX is an API to for managing java applications.

Abstract the instrumentation for management information to a common interface to facilitate integrated management.

Distribute management by moving management functions to the agents.

Realtime deployment of services and updates.Possible to use to manage any application or

device (via JNI or SNMP etc..)

Page 4: JMX

JMX Architecture

Agent Layer (MBeanServer)

Agent ServicesNotificationsMonitors/TimersMLET

Instrumentation Layer

MBeans

Java Application ApplicationServer

Manageable Device

RMIConnector

HTMLAdapter

SNMPAdapter

SNMPRMI

ManagementLayer

JavaClient

WebBrowser

SNMP Manager(HP OpenView)

Page 5: JMX

MBeanServer

The core of the agent. It provides a registry for MBeans.

Allows clients to discover and execute operations exposed by the MBeans

Makes available various services to facilitate management (I.e. monitoring, scheduling, etc)

Use “ObjectName” class to register objects with the MBeanServer

Page 6: JMX

Instrument your resources as MBeans

MBean stands for “managed bean”MBeans can represent a physical device

or an application You decide which attributes and methods

you want to expose for management.Use design patterns similar to JavaBeansMBeans are exposed in an agent.

Page 7: JMX

Standard MBeans

The simplest MBeanProvides a static representation of a

manageable resource.Implements a management interface of

attributes and methods that a device or application exposes for management.

Page 8: JMX

Notifications

Can be used to inform registered listeners with important events or state changes.

Similar to the java event modelRegister once to all types of notificationsCan supply a filter to say which

notifications it is interested in.

Page 9: JMX

Dynamic MBeans

Useful if the management interface is not stable.

The management interface is defined at runtime.

Developer is responsible for checking the validity of the invocations.

Page 10: JMX

DynamicMBean Interface<<Interface>>

DynamicMBean

getAttribute(String attribute)setAttribute(Attribute attribute)getAttributes (String[] attributes)setAttributes(AttibuteList attributes)getMBeanInfo()invoke(String actionName, Object[] params)

Page 11: JMX

Model MBeans

Most flexible and thus most complicated MBeans

Extension of the dynamic MBeanDevelopers do not write an MBean class The agent must supply the

RequiredModelMBean and the Management Interface is defined outside of the Bean via setter methods.

Features include persistence, logging, and attribute caching.

Page 12: JMX

Connectors/Adapters

A connector makes a Java Management Extensions (JMX) API MBean server accessible to remote Java technology-based clients.

Adapters are similar to connectors except they provide protocol translations (I.e. SNMP, HTML, etc.)

Page 13: JMX

Agent Services

Mlet; (Management Applet) Dynamically adds class files to the server either locally or from a remote location.

Relation Service; Allows the definition of relationships between Mbeans

Monitors: Observe Mbean attributes and emit notifications when values change.

Timers: Emits user defined notifications at specific times.

Page 14: JMX

JMX Remote APIAdds remote capability to the JMX specMakes the JMX agent accessible from outside the JVM.Developed through the JCP JSR 160Standard support via RMIOptional support via TCP Sockets (JMXMP)API is as close as possible to the API defined by the

JMX API.Also support discovery/lookup services and defines

security between the client and server. As with RMI code must handle communication

exceptions

Page 15: JMX

J2EE Management

An MBean can get data directly from an EJB by invoking its access methods.

An MBean can receive data being pushed from an EJB.

Registers and Deletes an MBean with a JMX agent upon creation and destruction of an EJB

Page 16: JMX

J2EE Management Spec JSR77

This specification represents a model of the J2EE application server, and its subcomponents, that all J2EE-compliant application vendors are required to expose

Requires JMX Part of J2EE 1.4 specSpecifies the MEJB, which is a session bean, to

expose the agent to remote clients.

Page 17: JMX

Available JMX Implementations

Sun JMX 1.2.1 and Remote API 1.0 RIJDMK value added product for purchase.

JBOSS JBOSS-MXJMX Compliant Implementation availableMicroKernal Application architecture is based on JMX Agent

technology.NetManage

Various products for sale to help build and manage applications via JMX

MX4JOpenSource Implemenation of JMX 1.1Currently working on 1.2Currently working on Remoting API

Page 18: JMX

Future Directions

Use of metadata Persistence Reliable event handling Master-agent/sub-agent functionality Manageability for J2EE™ apps

Page 19: JMX

DemoLogin Monitor

Login Screen

User

Jboss Application Server

UserInfoEntity Bean

Jmx Agent

UserInfoMgrMBean

ManagementConsole

User Login(increases login counter)

Web Browser Talks to MBeanServer

Retrieve number of LoginsEnable/Disable login permissions

Page 20: JMX

Books

JMX in ActionBenjamin G. Sullins, Mark WhipplePublisher: Manning Publications Company

JMX: Managing J2EE with Java Management ExtensionsMarc Fleury, Juha Lindfors

Publisher: Sams Java and JMX: Building Manageable Systems

Heather Kreger, Ward K. Harold, Leigh Williamson, Ward HaroldPublisher: Pearson Education

Java Management ExtensionsJ. Steven Perry

Publisher: O'Reilly & Associates, Incorporated JMX Programming

Mike JasnowskiPublisher: Wiley, John & Sons, Incorporated

Page 21: JMX

References Sun JMX Page:

http://java.sun.com/products/JavaManagement JMX Forum [email protected] JBOSS MX:

http://www.jboss.org/developers/projects/jboss/jbossmx.jsp

AdventNet: www.adventnet.com http://www.gartner.com/reprints/adventnet/108841.html Interview with Chris Ebro

http://www.theserverside.com/events/library.jsp JSR77 Aricle

http://www.onjava.com/pub/a/onjava/2002/03/27/jsr77.html