Sunteți pe pagina 1din 10

A JMX Toolkit for Merging Network Management Systems

Feng Lu Kris Bubendorfer

School of Mathematical and Computing Sciences


Victoria University of Wellington,
P. O. Box 600 Wellington, New Zealand,
Email: Feng.Lu@mcs.vuw.ac.nz, kris@mcs.vuw.ac.nz

Abstract need for more scalable and flexible network manage-


ment approaches is leading to greater decentralisa-
The ever increasing size of networks has resulted in tion (Simoes 1999).
a corresponding escalation of administration costs Dynamic extensibility is one of the solutions that
and lengthy deployment cycles. Clearly, more scal- has been used to support the distributed network
able and flexible network management systems are management model. The extensible agent can add
required to replace existing centralised services. The or delete managed objects and management services
work described in this paper forms part of a new at run time upon requests by other management en-
network management system that fuses dynamic ex- tities. Recently, Sun Microsystems introduced a set
tensibility, Java Management Extension (JMX), and of standards to equip Java with an extensible agent
mobile agents. The primary focus is on integra- model for distributed management, known as Java
tion with the many widely deployed legacy SNMP- Management Extension (JMX).
based network management systems. One of the pri- JMX aims to achieve the goal of scalable, dis-
mary contributions is the design of a generic SNMP tributed network management (JMX1.2 2002). Its
adaptor to enable JMX compliant agents to be ac- support for mobile code enables the transfer of
cessed by SNMP-based management applications. A lightweight applications to management agents at
set of SNMP APIs have been developed to support runtime, delegates the management tasks from a cen-
the development of the SNMP adaptor. A number tralised manager to management agents distributed
of other tools have been developed to support the around the network, and place the management tasks
SNMP adaptor, these include: a Management Infor- closer to the management data. This reduces network
mation Base (MIB) compiler that automatically gen- traffic and increases scalability (Lange et al. 1999).
erates MBeans representing a given SNMP MIB; and Also, the JMX component based architecture allows
a SNMP proxy service to allow non-SNMP manage- each JMX resource or service to be plugged into or re-
ment applications to access the SNMP agent using a moved from the management agent dynamically, de-
variety of protocols. pending on the runtime network requirements. This
means that a JMX based implementation can scale
Keywords: JMX, Network Management, SNMP from small handhold devices to large telecommunica-
tions switches.
1 Introduction However, legacy management systems are still
widely deployed. Network managers have to rely on
Traditional network management (NM) approaches, the legacy management protocol to access the net-
such as SNMP (Simple Network Management Proto- work resources in the heterogeneous network envi-
col) and CMIP (Common Management Information ronment. Therfore, a JMX based solution needs to
Protocol), are based on a static centralised manage- coexist with and integrate with traditional network
ment platform: a centralised manager acting as client management systems, like SNMP, instead of replac-
controls the entire network through agents which re- ing them. It is attractive and cost-efficient to develop
side in each network node acting as server. Agents and deploy a distributed management system using
are responsible for monitoring and controlling man- JMX that can cooperate with deployed legacy sys-
aged objects in the network. The manager has the tem. This interoperability can be achieved by equip-
responsibility of collecting data from agents, inter- ping the JMX-based solution with SNMP capability.
preting that data and directing the agents (Yemini Without it, the JMX-based solution will not become a
et al. 1991). However, with the rapid growth of net- general solution for distributed network management.
works, such approaches are no longer suitable as the The research efforts presented in this paper fo-
increasing complexity of these systems results in high cus on the the integration of JMX with traditional
administration costs and long deployment cycles. The SNMP-based network management systems. One of
the primary contributions is the design of a generic
c
Copyright 2006, Australian Computer Society, Inc. This pa- SNMP adaptor to enable JMX compliant agents to be
per appeared at Twenty-Ninth Australasian Computer Science accessed by SNMP-based management applications.
Conference (ACSC2006), Hobart, Tasmania, Australia, Jan-
uary 2006. Conferences in Research and Practice in Informa-
A set of SNMP APIs have been developed to support
tion Technology, Vol. 48. Vladimir Estivill-Castro and Gill the development of the SNMP adaptor. A number
Dobiie, Ed. Reproduction for academic, not-for profit purposes of other tools have been developed to support the
permitted provided this text is included. SNMP adaptor, these include: a Management Infor-
mation Base (MIB) compiler that automatically gen-
erates MBeans representing a given SNMP MIB; and
a SNMP proxy service to allow non-SNMP manage-
ment applications to access the SNMP agent using a
variety of protocols.
2 Background enables the manager to transfer the delegation code,
to control the behaviour of the delegation code
The majority of deployed network management sys- (execute, suspend and stop etc.), and to retrieve the
tems utilise a centralised approach, where the man- results of the execution. The delegation language
agement application periodically accesses the data is used to write management functions, that can
collected by a set of software modules on network be executed at runtime. Several different languages
devices. The software modules on network devices have been in different research prototypes ranging
are mainly concerned with information gathering and from high-level interpreted languages to low-level
simple calculation, while the management application stack-oriented languages (Schonwalder 1997). A
handles decision making and higher level functions. MbD agent acts in both an agent role and a manager
The centralised approach is driven by two assump- role. To managers requesting information from the
tions (Goldszmidt 1993): MbD Manager, it is an agent, while to those agents
it queries, it is a manager. The MbD agent provides
• Network devices lack resources to execute com- the services to parse and execute received delegation
plex computational tasks. code. It also provides the interfaces that enable
• Management data and functions are relatively the remote manager to control the execution of the
simple. delegation and retrieve the results. In addition, the
MbD agent can delegate its management functions
The Simple Network Management Protocol is the to other MbD agents.
dominant protocol in existing managed systems. The Dynamic extensibility has been used to support
protocol is designed to be an easily implemented, the MbD model for distributed network management.
basic network management tool. The SNMP set of Extensible agents are MbD agent that can dynami-
standards defines an information management model cally add or delete managed objects upon the requests
along with a protocol for the exchange of the informa- from other management entities. The early extensible
tion between a managed device with an SNMP agent agent model is based on the SNMP framework with
and an SNMP manager. International Standard Or- a distributed MIB consisting of a static MIB resid-
ganisation (ISO10165-1 1993) presents another gen- ing in the master agent and several temporary MIB
eral management information model of OSI systems dynamically registered by subagents.
management information. The ISO model has a sim- This paper relates our experience in designing
ilar approach to the SNMP management model, but and implementing a JMX based network management
differs in the way it operates. toolkit.
The rapid expansion of networks has resulted in
real network management problems that can’t be ad-
equately addressed (Meyer et al. 1995). Also, the 3 JMX Architecture
computational capability of network devices has in- The JMX specification provides a framework for a
creased. The increase in the capability of managed distributed management model based on manage-
devices has made it possible to distribute complex able resources, dynamically extensible agents and dis-
computations and significant duties to the managed tributed management services as shown in Figure 1.
devices (Puliafito et al. 2000). Research on the de- The JMX architecture is separated into three layers:
centralised approaches to network management be- the instrumentation level, the agent level and the dis-
gan as early as SNMPv1’s RMON (Remote Network
Monitoring) MIB. The core of RMON are the re- tributed services level.
mote monitors, that take responsibility for the col- JMX−compatible Other Management JMX Manager
Management Application Applications
lection and analysis of statistical information on net-
work traffic and device status on sub-networks. The
remote monitors report only significant information Distributed
Services Level
to the SNMP managers. The enhanced SNMPv2 pro-
vides a manager-to-manager (M2M) MIB to support
a hierarchical management architecture. Similar to
the RMON, the M2M allows a sub-manager to func- C PA C
MBean
tion as a remote monitor for a sub-network. The lat- Server

est SNMPv3 management framework makes it possi- Agent Level


ble to develop a set of distributed entities, composed Agent
Services
of several interacting modules. However, the SNMP
management framework does not specifically address
distribute network management. Instead, the IETF Resources
(MBeans)
Instrumentation
Level
DIAMAN working group proposes a distributed man-
agement architecture based on the SNMP manage- C − Connector
PA − Protocol Adaptor
ment framework (DISMAN 1996).
On the other hand, Yemini and Gold-
szmidt (Yemini et al. 1991) proposed the Management Figure 1: JMX Architecture
by Delegation (MbD) model for distributed network
management. The fundamental idea behind this
approach is to dynamically distribute management
functions amongst management entities. The MbD 3.1 Instrumentation Level
model is based on the technology ”code mobility”. The instrumentation level provides a specification for
It moves the code, describing management functions, implementing JMX manageable resources. A resource
closer to the data they process. Moving code is can be an application, a device, or the implemen-
more efficient if the amount of data that needs to be tation of a service. A JMX manageable resource
transferred is larger, and reduces the total amount must comply with the MBean standard defined in the
of network management traffic (Schonwalder 1997). JMX specification, and may be dynamically added
The MbD model consist of three parts: a delegation to or removed from the JMX agent. MBeans encap-
protocol, a delegation language and an agent. The sulate manageable objects as attributes and opera-
delegation protocol is used to communicate between tions through their public methods, and utilise de-
managers and agents. The delegation protocol
sign patterns to expose them to management appli- MBean server acts as a central registry for MBeans
cations (JMX1.2 2002). managed by the agent. Only registered MBeans may
There are two kind of MBean. Standard MBeans be accessed from outside of the MBean server. The
provide a static management interface, which is fixed MBean server provides a set of interfaces to manip-
at compile time and is invoked by reflection. The ulate MBeans. All management requests are han-
standard MBeans’ interfaces are made up of the meth- dled by the MBean server, which dispatches them to
ods for reading and writing attributes and for invok- the appropriate MBean. Through the MBean server,
ing operations. The design pattern followed by a stan- management applications may: register or deregis-
dard MBean is derived from the JavaBeans compo- ter MBeans, browse and query MBeans, discover the
nent model (JavaBeans 1999). In this design pattern, management interface of MBeans, read or write the
attributes are exposed through the getter and setter values of MBeans’ attributes, invoke the operations
methods in the MBeans’ interface. Attributes may be exposed by MBeans, and register and deregister no-
read-only, write-only or read-write. The return value tification listeners for MBeans.
or arguments of methods for attributes must conform JMX agent services are also MBeans that provide
to the data type of attributes. Operations are ex- services for other MBeans or management applica-
posed by the methods other than getter and setter in tions. There are four standard services defined in the
the MBeans’ interface. They can be defined with any JMX specification: Dynamic Loading Service, Mon-
number of arguments with any data types. itoring Service, Timer Service and Relation Service.
Dynamic Loading Service allows the agent to instan-
public interface DynamicMBean { tiate MBeans using Java classes and native libraries
public Object getAttribute(String attribute) dynamically downloaded from the network. Monitor-
throws AttributeNotFoundException, MBeanException, ReflectionException;
ing Service notifies its listeners on certain conditions
public AttributeList getAttributes(String[] attributes);
or events. Timer Service sends notifications at prede-
public MBeanInfo getMBeanInfo();
termined intervals and acts as a scheduler. Relation
public Object invoke(String actionName, Object[] params, String[] signature)
throws MBeanException, ReflectionException;
Service defines associations between MBeans.
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException,InvalidAttributeValueException,
MBeanException, ReflectionException; 3.3 Distributed Services Level
public AttributeList setAttributes(AttributeList attributes);
} The distributed services level defines management in-
terfaces and components that allow remote manage-
ment applications to perform operations on agents
Figure 2: DynamicMBean Interface through different protocol adaptors and connectors.
Both protocol adaptors and connectors use the ser-
Dynamic MBeans conform to a specific interface vices of the MBean server to apply the management
that exposes the management interface at runtime. operations they receive to the target MBeans, and
Unlike standard MBeans, dynamic MBeans do not to forward notifications, such as an attribute change
have getter or setter methods for each attribute and notification, to management applications. Both pro-
operation. Instead, the DynamicMBean interface is tocol adaptors and connectors should preferably be
defined to provide generic method for getting or set- implemented as MBeans. This offers greater flexibil-
ting an attribute and for invoking an operation. As ity to their operation as they can be activated or de-
shown in Figure 2, the getMBeanInfo method defined activated through any of the other available adaptors
in the DynamicMBean interface returns an object or connectors.
which contains meta information about the MBean’s There are two main differences between protocol
attributes, operations and notifications that may be adaptors and connectors, though they are similar in
emitted by the MBean. terms of functionality:
Using this meta information, management appli-
cations can access the MBean’s attributes and invoke • Management applications that connect to proto-
the MBean’s operations through generic methods de- col adaptors access the JMX agent through oper-
fined by the DynamicMBean interface. Compared ations defined by the given protocol, and the op-
with standard MBeans, dynamic MBeans provide a erations are then received by protocol adaptors
more flexible way to instrument resources and make and are mapped to those of the MBean server
it simple to instrument existing JMX incompatible through protocol adaptors; whereas connectors
resources (legacy management resources, etc.). provide a higher level view for the JMX agent
Dynamic MBeans can be further refined into two through the local representation of the MBean
useful specialisations: server. The remote management applications us-
ing connectors may access the JMX agent as if it
• An open MBean is a dynamic MBean that relies were local.
on a small, predefined set of universal Java Types
to describe managed objects. It is useful where a • Management applications that connect to proto-
management application and agent do not share col adaptors are usually tied to a given proto-
application-specific data types. col, whereas management applications which use
connectors may use different protocols as long as
• The model MBean, is a generic configurable man- corresponding connectors are provided.
agement template for managed resources. Model
MBeans can be used to instrument almost any
resources rapidly. 4 SNMP Adaptor
The SNMP adaptor makes the JMX agent accessible
3.2 Agent Level from legacy SNMP managers. The SNMP adaptor
The agent level provides a specification for imple- emulates the standard SNMP agent, and is configured
menting the JMX agents that control the MBean re- dynamically to provide mappings between SNMP and
sources and make them available to management ap- MBeans and JMX Notifications via XML mapping
plications. A JMX agent consists of a MBean server, a files. As shown in Figure 3, the SNMP adaptor con-
set of agent services, and at least one communication sists of a SNMP protocol engine and a MIB registry.
protocol adaptor or connector, see section 3.3. The The SNMP protocol engine is used to receive and
parse SNMP messages to determine the type of re- 5. The response message is returned back to the
quest and the Object Identifier (OID) of the MIB message dispatcher and then is forwarded to the
object. The engine queries the MIB registry and gets transport layer.
the proxy for the MBean object identified by the OID.
The engine then invokes the appropriate access func- 6. The transport layer returns the response mes-
tion on the proxy, which will forward the invocation sage. The transport layer also forwards SNMP
to the appropriate MBean object registered with the trap messages to registered SNMP managers.
MBean server. The notification listener receives the
notifications, which the SNMP adaptor is interested 4.2 MIB Registry
in, and forwards them to the SNMP protocol engine.
The SNMP protocol engine generates the correspond- The MIB registry organises MBean proxies into a
ing SNMP trap message. SNMP OID tree structure. Figure 5 shows the class
hierarchy for the MIB objects in the MIB registry.
These objects are organised as several MIBGroup ob-
SNMP Request
SNMP Adaptor
jects. A MIBGroup object can not contain other
Dynamical Proxies
SNMP Trap
SNMP Protocol
Engine
look up
MIBGroup objects. The managed objects in the
m1 proxy MBean m1
MIBGroup are represented as MIBLeafProxy objects

MBean Server
MIB Registry or MIBTableProxy objects in terms of the node type.
m2 proxy MBean m2
Notification
Listener
x

Figure 3: SNMP Adaptor y1 y2 y3

4.1 SNMP Protocol Engine (tabular) z1 z2 z3 z4


The SNMP protocol engine is built on top of the JoeS-
NMP API (OpenNMS 2002) and supports SNMP
protocol versions V1, V2c. It consists of several com- r1 r2
ponents: transport layer, message dispatcher, mes-
sage handler and trap generator. These components
interact with each other to facilitate communications Figure 6: MIBGroup Example
between the SNMP manager and the SNMP adaptor.
Figure 4 describes how the SNMP message is handled For instance in Figure 6, the node x has three child
by the SNMP engine. nodes: y1, y2 and y3. The node y1 is a leaf node. The
node y2 has two child nodes: z1 (tabular node) and
z2 (leaf node). The node y3 also has two child nodes:
z3 (leaf node) and z4 (leaf node). This OID tree can
Message Dispatcher
SNMPv1 Handler
be represented as follows:
MIB
SNMP
Message
SNMPv2c Handler • MIBGroup x contains MIBLeafProxy y1
Transport Layer Message Handler
• MIBGroup y2 contains MIBTableProxy z1 and
MIBLeafProxy z2
Trap Generator
SNMP Engine • MIBGroup y3 contains MIBLeafProxy z3 and
MIBLeafProxy z4

Figure 4: SNMP Protocol Engine Referring back to Figure 5, the MIBEntry abstract
class describes the basic structure for a managed ob-
ject. It contains the attribute oid which is used to
1. The SNMP request message is received by the identify the managed object. It also defines three ab-
transport layer, and then is forwarded to the stract methods getRequest, getNextRequest and setRe-
message dispatcher. The current transport layer quest to handle three primitive SNMP actions: GET,
supports UDP. GETNEXT and SET. Both the MIBLeaf class and
the MIBTable class are sub class of the MIBEntry
2. The message dispatcher parses the SNMP mes- abstract class.
sage to determine the SNMP version and to ex- A MIBLeaf class represents a scalar type managed
tract the Protocol Data Unit (PDU) from the object, but it also can represent a columnar object of
message. Then, it forwards the extracted PDU a SNMP table. A columnar object defines the be-
to the appropriate message handler. haviour of managed object instances in a particular
3. There are two message handlers, the SNMPv1 column of a SNMP table (Agent++ 2000). The MI-
handler and SNMPv2c handlers which are re- BLeaf object contains an attribute value which rep-
sponsible for the corresponding version’s SNMP resents the instance of the managed object. The MI-
message. The message handler parses the PDU BLeafProxy class extends the MIBleaf class with two
to determine the PDU type and the OIDs of the additional attributes: mbeanName and attribute. The
required MIB objects. The message handler then mbeanName represents the object name of the target
looks up the MIB Registry to get the required MBean object, and the attribute represents one of the
MIB objects. attributes of this MBean object. With these two at-
tributes, the MIBLeafProxy object acts as a proxy
4. The message handler invokes the appropriate ac- for the MBean object, and maps the SNMP actions
cess method on the MIB objects, and then con- to the appropriate methods on the JMX agent. For
structs a response message with the new values instance, when the methods getValue or setValue is
of the MIB objects. invoked, the MIBLeafProxy object invoke the method
MIBRegistry
MIBGroup # groups : SortedSet
# content : SortedSet + addGroup(group : MIBGroup) : void
+ add(item : MIBEntry) : void
+ find(oid : SnmpObjectId) : MIBEntry
+ remove(oid : SnmpObjectId) : void
+ findNext(oid : SnmpObjectId) : MIBEntry
+ getContent() : SortedSet + findPrev(oid : SnmpObjectId) : MIBEntry

MIBLeafProxy
MIBTableProxy
# oid : SnmpObjectId
# oid : SnmpObjectId
# value : SnmpSyntax
# attribute : ModelMBeanAttributeInfo # rows : SortedSet
# mbeanName : ObjectName # columns : MIBTableRow
# mbeanName : ObjectName
+ getOID() : SnmpObjectId
+ getValue() : SnmpSyntax # mbeanInfo : ModelMBeanInfo
+ setValue(value : SnmpSyntax) : void # updateListener : NotificationListener
+ getRequest(req : Request, index : int) : void + getOID() : SnmpObjectId
+ getNextRequest(req : Request, index : int) : void + addColumn(column : MIBLeaf) : void
+ setRequest(req : Request, index : int) : void + addRow(index : SnmpObjectId) : void
+ setAttribute(attribute : ModelMBeanAttributeInfo) : void + getRequest(req : Request) : void
+ getNextRequest(req : Request, index : int) : void
+ setMBeanName(name : ObjectName) : void
+ setRequest(req : Request, index : int) : void
+ setMBeanInfo(mbeanInfo : ModelMBeanInfo) : void
+ setMBeanName(name : ObjectName) : void

MIBEntry
# oid : SnmpObjectId
+ getOID() : SnmpObjectId
+ getRequest(req : Request, index : int) : void
+ getNextRequest(req : Request, index : int) : void
+ setRequest(req : Request, index : int) : void

MIBLeaf MIBTable
# oid : SnmpObjectId # oid : SnmpObjectId
# value : SnmpSyntax # rows : SortedSet
+ getOID() : SnmpObjectId # columns : MIBTableRow
+ getValue() : SnmpSyntax + getOID() : SnmpObjectId
+ setValue(value : SnmpSyntax) : void + addColumn(column : MIBLeaf) : void
+ getRequest(req : Request, index : int) : void + addRow(index : SnmpObjectId) : void
+ getNextRequest(req : Request, index : int) : void + getRequest(req : Request, index : int) : void
+ setRequest(req : Request, index : int) : void + getNextRequest(req : Request, index : int) : void
+ setRequest(req : Request, index : int) : void

MIBTableRow
# index : SnmpObjectId
# items : SortedSet
+ getIndex() : SnmpObjectId
+ setIndex(index : SnmpObjectId) : void
+ addItem(item : MIBLeaf) : void
+ getItem(index : int) : MIBLeaf

Figure 5: MIB Registry Class Hierarchy Diagram


getAttribute or setAttribute on the JMX agent with the RMIConnectorServer. The RMIConnectorServer
the mbeanName and the attribute as parameters to exposes four methods defined in the interface JMX-
access the attribute of the target MBean object. ConnectorServerBean, see Figure 7. Two of them,
A MIBTable class represents a SNMP table (tab- isActive and getAddress, are the get methods of the
ular type managed object). A SNMP table may attributes active and address, and other two are op-
have multiple rows, and each row consists of multi- erations according to design pattern described in the
ple columnar objects. The MIBTableRow class is de- JMX 1.2 specification. Our prototype only supports
fined to represent a row of a SNMP table. It provides the mapping of MBean attributes as SNMP does not
the methods to add MIBLeaf objects, which repre- support objects. The file MBeansToMIB.xml is used
sent columnar objects in the row, and methods to get to describe how to map MBeans into the MIB. The
and remove them. The MIBTable object may contain mapping file assigns the OID ”1.3.6.1.4.9876.1.1” to
multiple MIBTableRow object. The MIBTable con- the MBean RMIConnectorServer, and describes the
tains a group of MIBLeaf objects named meta colum- MBean’s ObjectName so that the SNMP adaptor can
nar object, which describe the structure information locate the RMIConnectorServer instance through the
for the row. This group of MIBLeaf objects is or- MBean server. It also assigns the OID respectively to
ganised as a MIBTableRow object named columns. the attributes active and address.
When a new row is added, MIBTable will clone the The mapping file also maps the Java data type
MIBTableRow object to create a new MIBTableRow of the MBean attributes to the MIB data type. In
object. Each columnar object in the new row is the this case, the SNMP adaptor loads the mapping file,
copy of the meta columnar object of its column, but and generates a MIBGroup object with two MIBLeaf-
with a different value. The MIBTable class provides Proxy objects which respectively represent the at-
the methods to manipulate columnar objects. tributes address and active.
The MIBTableProxy class is a sub class of the
MIBTable class. It acts as the proxy for a special kind 4.3 MIB Compiler
of MBean object, which has a TabularData type at-
tribute. TabularData is defined in the JMX specifica- As described in Section 4.2.1, existing MBeans can be
tion and describes a table structure with an arbitrary mapped into the MIB using the MBeansToMIB.xml
number of rows that can be indexed by any number file. However, JMX manageable resources must follow
of columns (JMX1.2 2002). Each row is a Composite- the design patterns and interfaces defined in the JMX
Data object, which is a hash map with multiple data 1.2 specification. Any incompatible resources must be
items. The CompositeType object is used to describe instrumented as MBeans so that they can be managed
the CompositeData object. All rows in a TabularData by a JMX agent.
object must be associated with the same Composite- Our MIB compiler automatically generates
Type object. This special kind of MBean object is MBeans representing a given SNMP MIB. The MIB
automatically generated from the SNMP table by the compiler consist of two components: a MIB parser
MIB compiler (see Section 4.3). and a code generator. The MIB parser imports a MIB
The MIBTableProxy class supports a cache mech- file and generates an intermediate representation.
anism for efficiency. When a MIBTableProxy object The code generator generates the Java source code
initialised, MIBTableProxy queries the MBean (iden- and the XML file. The generated code is based on the
tified by the MIBTableProxy’s two attributes: mbean- JMX’s model MBean specification (JMX1.2 2002)
Name and MBeanInfo), and stores the MBean ob- and can be used to create a model MBean on the fly.
ject’s TabularData type attribute in the cache. The The generated XML is used to dynamically configure
MIBTableProxy object also registers a notification the model MBean. The model MBean provides
listener for the MBean object. When the MBean’s management interfaces for non JMX compatible re-
TabularData object is changed, the MIBTableProxy sources. This significantly reduces the programming
object will receive a notification and will query the burden and means that a developer can instrument
MBean to update the cache. The cache mecha- existing resources according to the JMX specification
nism is more efficient because the MIBTableProxy as little as three or five lines of code.
object does not need to contact the MBean when
a SNMP management application performs GET or 4.3.1 MIB Parser
GETBULK actions on it. Only SET actions cause
the MIBTableProxy object to update the MBean’s The MIB file is a normal text file written in Abstract
TabularData object. Syntax Notation One (ASN.1) (ISO8824 1990) lan-
guage, a formal language used to define abstract syn-
4.2.1 Generating Dynamic MBean Proxies taxes of application data.
Rather than having single ASN.1 compiler with a
Both the MIBLeafProxy and MIBTableProxy objects lexer, a parser and a code generator, we utilise dele-
act as proxies for a MBean. The SNMP operations gating compiler objects (DCO) (Bosch 1996), a novel
performed on them are mapped to the accessor meth- approach to compiler construction that provides mod-
ods on the appropriate MBean objects, and then are ular and extensible implementation of compilers. In
forwarded to the MBean server. The MBean server DCO compilation is achieved through the coopera-
finds the target MBean object, invokes the method tion of a group of compiler objects. A compiler ob-
on it and then returns the result or raises the excep- ject is only responsible for a particular part of the
tion. Proxies are dynamically generated from XML syntax, and has its own lexer and parser. The pro-
mapping files and are added into the MIB Registry. gramming language is decomposed into a set of struc-
The mapping files define the mapping relationship be- ture. Each structure is compiled by its associated
tween the MIB and MBean objects. Figure 7 provides compiler object. As shown in Figure 8, a MIB file
an example of the mapping of a MBean object into can be decomposed into ten modules. The TypeAs-
the MIB. signment module is used to define a new data type.
The RMIConnectorServer is implemented as a The new data type can be Simple Type, Structured
MBean so that it can also be managed through proto- Type or Subtype. The ValueAssignment module is
col adaptors or connectors. There must be a relation- used to assign a value to a variable. In the MIB file,
ship between the RMIConnectorServer and the nodes the ValueAssignment module is mostly used to assign
in the MIB; otherwise the SNMP adaptor has no idea a value to the Object Identifier variable. The Im-
how to map a SNMP request to the operations on port module is used to import the types and variable
iso (1)

org (3)

dod (6)

internet (1)

directory (1) mgmt (2) experimental (3) private (4)

mib−2 (1) enterprises (1)

public interface JMXConnectorServerMBean { vuw (9876)


public void start() throws IOException;
pubic void stop() throws IOException; mjmx (1)
public boolean isActive();
public String getAddress(); RMIConnectorServer (1)
}
public class RMIConnectorServer
implements JMXConnectorServerMBean {
... active (1) address (2)
}

<MBeanMapping>
<MBean name="nz.ac.vuw.mjmx.remote.rmi.RMIConnectorServer"
objectName="jmx:Connectors:type=RMIConnector" oid="1.6.3.1.4.1.9876.1.1">
<attribute name="active" type="java.lang.Boolean" oid="1" getMethod="isActive" mibType="INTEGER"/>
<attribute name="address" type="java.lang.String" oid="2" getMethod="getAddress" mibType="DisplayString"/>
</MBean>
</MBeanMapping>

Figure 7: Mapping a MBean into the MIB

declared by other MIB files. The other seven mod- case, X denotes the attribute name. Also, the code
ules, including ModularIdentity, ObjectType, Textual- generator generates the Java class for each SNMP ta-
Convention, ObjectGroup, NotificationType, Notifica- ble. The methods to access the rows in the SNMP
tionGroup and ModuleComppliance, represent seven table are defined in this Java class. In addition, each
macros defined in the MIB specifications. Our MIB generated Java class is associated with a XML config-
compiler utilises a separate compiler object for each uration file that describes the mapping relationship
of the ten MIB modules. Each compiler object has a between the Java class and the MIB. However, the
its own lexer and parser. generated instrumentation code only define the inter-
MIB compilation firstly eliminates all unneeded in- faces and provide skeleton code to describe how JMX
formation in the MIB file (such as comments) and incompatible resources can be accessed. The remain-
then passes the stream through the ten DCO com- ing manual tasks are to complete the skeleton code
piler objects. Each DCO compiler performs its lexi- and implement the defined interfaces.
cal analysis and then its parser provides the syntactic The generated Java classes can not be accessed di-
analysis. The entire syntactic analysis of the MIB rectly by the JMX agent and must be wrapped into
file is the result of the collaboration of the different the model MBeans. The model MBean provides a set
DCO parsers. Since only a very small subset of ASN.1 of interfaces which allow the JMX agent to perform
syntax is used in each DCO, the complexity of the im- the management operations on the resources wrapped
plementation of DCO parser is significantly reduced. in the model MBean object. The wrapping process
The output of DCO parsers are module objects rep- starts by extracting the information for attributes,
resenting the different modules. Module objects are operations and notifications from the XML file asso-
divided into two groups: type groups and variable ciated with each Java class and then added this in-
groups. Objects in the type group represent a data formation to the model MBean. The whole process
type, and objects in variable group represent an in- is done in one line code as follow. The method con-
stance with type and value. Then, the module ob- vertXmlToMBeanInfo converts the xml file into the
jects go through semantic analysis to check if objects MBeanInfo object which describes custom attributes,
are legal and meaningful (for instance, the values are operations and notifications information, and then
valid, the types are defined, the compulsory attributes the RequiredModelMBean constructor use these in-
are set, and so on). The final step is to organise the formation to construct a customised model MBean in-
objects as a MIB tree in terms of the OID value of stance. The wrapping process is done automatically.
each object. An optional XML file is also generated The users can edit the file JMXModelMBeanInfo.xml
to represent the MIB file in the XML format. to add the configuration file location and name for
resources they want to wrap. When a JMX agent
4.3.2 Code Generator is initialzied, it checks out the file JMXModelMBean-
Info.xml and then generates the model MBean for the
The code generator walks through the MIB tree ex- resources.
ported by the MIB parser and generates the instru-
mentation code and configuration files for the vari- new RequiredModelMBean(convertXmlToMBeanInfo(xml));
ables in the MIB tree. The code generator generates
a Java class for each MIB group node. Every leaf node 4.3.3 A Code Generation Example
in the MIB group is represented by an attribute of the
Java class. The corresponding accessor methods, such A code generation example for a MIB group is shown
as getX or setX are defined in the Java class. In this in Figure 9. The system group describes a set of ob-
jects common to all managed systems. It consists
Lexical Analysis Syntactic Analysis

TypeAssisnment Module Lexer TypeAssisnment Module Parser

ValueAssignment Module Lexer ValueAssignment Module Parser

Import Module Lexer Import Module Parser

MIB ModularIdentity Module Lexer ModularIdentity Module Parser


Type Table MIB Tree
ObjectType Module Lexer ObjectType Module Parser
Semantic Analysis
TextualConvention Module Lexer TextualConvention Module Parser
Variable XML
Table
ObjectGroup Module Lexer ObjectGroup Module Parser

NotificationType Mudule Lexer NotificationType Mudule Parser

NotificationGroup Module Lexer NotificationGroup Module Parser

ModuleCompliance Module Lexer ModuleCompliance Module Parser

Figure 8: MIB Parser

of eight scalar objects and a table object with four 4.4 SNMP Proxy
columns. The MIB compiler compiles the system
group MIB file and generates five files: The SNMP adaptor makes JMX resources accessi-
ble to legacy SNMP managers. However, non-SNMP
• System.java: a Java class representing the whole management applications can not access SNMP re-
system group except the table object sysORTable sources directly since they do not support the SNMP
protocol. We have designed and developed a SNMP
• System.xml: a configuration file describing the proxy to address this interoperability issue. As
mapping relationship between the System class shown in Figure 10, the MIB supported by a re-
and the system group in the MIB file mote SNMP agent is represented by multiple model
MBeans. These model MBeans are registered within
• SystemORTable.java: a Java class representing the MBean server and can be accessed by multiple
the table object sysORTablein the MIB file protocols, such as Java RMI. These model MBeans
• SystemOREntry.java: a Java class represent- act as proxies and the operations on them are for-
ing four column objects in the table object warded to the appropriate remote SNMP agents
sysORTable through the SNMP proxy.

• SystemORTable.xml: a configuration file de-


scribing the mapping relationship between the
sysORTable class and the sysORTable object in Mapping File Mapping File Mapping File

the MIB file


The System class in Figure 9 contains eight at- JMX Agent

tributes that represent the eight scalar objects in the Connector Model MBean SNMP Agent
system group. The accessor methods for these at-
MBean Server

tributes are also included. The System class does Connector


Model MBean
SNMP Proxy

not include any OID information, but the configu- SNMP Manager

ration file System.xml describes the mapping relation Adaptor

between the attributes of the System class and the Model MBean SNMP Agent

scalar objects of the system group. When the System


class is wrapped into a model MBean and is registered
within a JMX agent, a proxy object is dynamically JMXSNMPProxyConf.xml

generated from the System.xml file and is registered


within the MIBRegistry in the SNMP adaptor (see
Section 4.2.1). This proxy object will call the System Figure 10: SNMP Proxy
class’s get and set method upon Get and SET SNMP
request. To create proxy objects representing the remote
The SysORTable class contains the attribute SNMP agent’s MIB, the MIB compiler is used to
sysORTable which represents the table object of the generated instrumentation code and xml configura-
system group. The row of the sysORTable is repre- tion files from the remote SNMP agent’s MIB file.
sented by the SysOREntry class. The SysOREntry However, only xml configuration files are used to
class contains four attributes that represent four col- create proxy objects. The instrumentation code is
umn objects. The access methods for these attributes simply discarded. The JMX implementation used
are also defined. The SysORTable class defines the in this project provides two basic model MBeans:
methods to manipulate the table object. The get- RequiredModelMBean and JMXSNMPProxyModelM-
SysORTable method is used to retrieve all rows in Bean. The RequiredModelMBean is used to in-
the table. The updateEntry method is used to up- strument MBean incompatible managed resources.
date an existing row or add a new row in the table, The operations on the RequiredModelMBean are for-
and the deleteEntry is used to delete a row from the warded to the managed resource. The JMXSNMP-
table. Similar to the System class, a proxy object is ProxyModelMBean does not instrument any managed
also generated from the SysORTable.xml and is asso- resources, but forwards the operations on it to the
ciated with the SysORTable class. SNMP proxy. Generating a JMXSNMPProxyMod-
elMBean instance using the toolkit is a single line of
code (as shown below).
System.java
System group MIB
public class System {
String sysDescr;
system OBJECT IDENTIFIER ::= { mib−2 1} String sysObjectID;
Long sysUptime;
sysDescr OBJECT−TYPE String sysContact;
SYNTAX DisplayString (SIZE (0..255)) String sysName;
ACCESS read−only String sysLocation;
STATUS current Integer sysServices;
::={ system 1 } Long sysORLastChange;

sysObjectID OBJECT−TYPE public System() {...}


SYNTAX OBJECT IDNETIFIER
ACCESS read−only public String getSysDescr() {...}
STATUS current public void setSysDescr(String value) {...}
::= { system 2 } ...
}
sysUpTime OBJECT−TYPE
SYNTAX TimeTicks System.xml
ACCESS read−only <ModelMBean name="example.System" group="1.3.6.1.2.1.1">
STATUS current <attributes>
::= { system 3} <attribute name="sysDescr" type="java.lang.String" oid="1"
getMethod="getSysDescr" mibType="DisplayString"/>
−− system group includes other five leaf nodes <attribute name="sysObjectID" type="java.lang.Long" oid = "2"
−− sysContact ::= { system 4 } getMethod="getSysObjectID" mibType="OBJECT IDENTIFIER"/>
−− sysName ::= { system 5 } ...
−− sysLocation ::= { system 6 } </attributes>
−− sysServices ::= { system 7 } <operations>
−− sysORLastChange ::= {system 8} ...
MIB Compiler

</operations>
</ModelMBean>

SysORTable.java & SysOREntry,java


sysORTable OBJECT−TYPE
SYNTAX SEQUENCE OF SysOREntry public class SysORTable extends JMXAbstractTable {
ACCESS not−accessible String[] indexNames;
STATUS current HashMap sysORTable;
::= { system 9 } NotificationListener listener;

sysOREntry OBJECT−TYPE public SysORTable() {...}


SYNTAX SysOREntry
ACCESS not−accessible public String[] getIndexNames() {...}
STATUS current public TabularData getSysORTable() {...}
INDEX { sysORIndex } public void updateEntry(Object[] indexObjects, CompositeData entry) {...}
::= { sysORTable 1 } public void deleteEntry(Object[] indexObjects) {...}
public void addNotificationListener(NotificationListener listener) {...}
SysOREntry ::= SEQUENCE { public void remoteNotificationListener(NotificationListener listener) {...}
sysORIndex INTEGER, }
sysORID OBJECT IDENTIFIER,
sysORDescr DisplayString, class SysOREntry {
sysORUpTime TimeStamp Integer sysORIndex;
} String sysORID;
String sysORDescr;
sysORIndex OBJECT−TYPE Long sysORUpTime;
SYNTAX INTEGER (1..2147483647
ACCESS not−accessible public Integer getSysORIndex() {...}
STATUS current public void setSysORIndex(Integer value) {..}
::= { sysOREntryEntry 1 } ...
}
sysORID OBJECT−TYPE
SYNTAX OBJECT IDENTIFIER SysORTable.xml
ACCESS read−only <ModelMBean name="example.SysORTable" group="1.3.6.1.2.1.1">
STATUS current <attributes>
::= { sysOREntry 2 } <attribute name="SysORTable" type="javax.management.openmbean.TabularData"
getMethod="getSysORTable" oid="9" mibType="table">
sysORDescr OBJECT−TYPE <columnAttribute name="sysORIndex" type="java.lang.Integer oid="1.1" mibType="INTEGER"/>
SYNTAX DisplayString <columnAttribute name="sysORID" type="java.lang.String" oid="1.2" mibType="OBJECT IDENTIFIER"/>
ACCESS read−only <columnAttribute name="sysORDescr type="java.lang.String" oid="1.3" mibType="DisplayString"/>
STATUS current <columnAttribute name="sysORUpTime" type="java.lang.Long" oid="1.4" mibType="TimeStamp"/>
::= { sysOREntry 3 } </attributes>
<operations>
sysORUpTime OBJECT−TYPE ...
SYNTAX TimeStamp </operations>
ACCESS read−only </ModelMBean>
STATUS current
::= { sysOREntry 4 }

Figure 9: A Code Generation Example


new JMXSNMPProxyModelMBean(objectName, SNMPProxyRef, References
convertXmlToMBeanInfo(xml));
A. Puliafito & O. Tomarchio(2000), Using Mobile
The objectName represents the name of the model Agents to implement flexible Network Man-
MBean object and the SNMPProxyRef is a reference agement strategies, Computer Communication
to the SNMP Proxy. The convertXmlToMBeanInfo Journal, 23(8):708–719.
method converts the xml file into the MBeanInfo ob-
ject that describes custom attributes, operations and Danny B. Lange & Mitsuru Oshima (1999), Seven
notification information. Good Reasons for Mobile Agents, Communica-
When a method of the JMXSNMPProxyModelM- tion of ACM, volume 42.
Bean object is invoked, the JMXSNMPProxyMod-
elMBean object forwards the invocation and ob- Frank Fock (2000), Agent++, An Object Oriented
ject name to the SNMP proxy. The SNMP proxy Application Programmers Interface for Devel-
checks the file JMXSNMPProxyConf.xml that de- opment of SNMP Agents Using C++ and
scribes the relationship between JMXSNMPProx- SNMP++, http://www.agentpp.com.
yModelMBean objects and remote SNMP agents. German Goldszmidt(1993), On Distributed Sys-
For instance, an JMXSNMPProxyModelMBean ob- tem Management, In Processings of the Third
ject with object name ”jmx:snmpagent:type=system” IBM/CAS Conference.
represents the System group of the MIB supported by
a SNMP agent. This SNMP agent resides in the host IETF DIMAN Working Group (1999), Dis-
”130.195.106.3” and listens on the port ”161”. After tributed Management (DISMAN) Charter,
locating the SNMP agent, the SNMP proxy converts http://www.ietf.org/html.charters/disman-
the invocation to a SNMP PDU, and sends it to the charter.html.
target SNMP agent.
International Organization for Standardization
(1990), Information Technology- Open Systems
5 Related Work Interconnection - Specification of Abstract
Syntax Notation One (ASN.1).
There are some commercial toolkits that provide
broadly similar functionality to the work presented International Organization for Standardization
in this paper, such as Sun’s JDMK toolkit (JDMK (1993), ISO 10165-1: Information Process-
1999). However, these are proprietary designs and ing System - Open Systems Interconnection
their details are not available in the public domain. - Structure of Management Information -
None-the-less, there are a number of important dif- Part1:Management Inforamation Model.
ferences that we have been able to identify. For
example, ordinary MBeans (those not generated by Jan Bosch (1996), Delegating Compiler Objects:
the JDMK’s MIB compiler) can’t be accessed by Modularity and Reusability in Language Engi-
SNMP managers, whereas our toolkit enables ordi- neering, Nordic Journal of Computing.
nary MBeans to be accessible to SNMP managers J. Schonwalder(1997), Network Management by Del-
via the ”MBean-To-MIB” configuration file. Another egation - From Research Prototypes Towards
difference is that JDMK generated MBeans are di- Standards, In Processings of 8th Joint European
rectly bound to the SNMP adaptor, whereas our Networking Conference.
MBean proxies are generated and bound at run time
via the MBean Server. This is a cleaner more flexi- K. Meyer, M. Erlinger, J. Betser, C. Sunshine, G.
ble solution, and conforms to the hourglass protocol Goldszmidt & Y. Yemini(1995), Decentralising
model (Shanmugam et al. 2002). Control and Intelligence in Network Manage-
ment, In Processings of International Sympo-
6 Conclusions sium on Integrated Network Management.
OpenNMS (2002), joeSNMP API,
The growing number of applications and services im- http://sourceforge.net/projects/joesnmp/.
plemented in Java has increased the demand for Java
based network management solutions. JMX provides Paulo Simoes (1999), Enable Mobile Agent Technol-
a standard way to enable manageability for any Java ogy For Legacy Network Management Frame-
based application, service or device (JMX1.2 2002). works, Technical Report, University of Coimbra.
However, most existing management systems can not
be managed directly via JMX compliant implementa- Sun Microsystem Inc. (2002), Java Management Ex-
tions. In this paper we present a toolkit that allows tensions Instrumentation and Agent Specifica-
the rapid development of JMX agents, and that can tion, v1.2
interoperate with legacy SNMP-based network man-
agement systems. The core of this toolkit is a generic Sun Microsystem Inc. (1999), Java Dynamic Manage-
SNMP adaptor to enable JMX compliant agents to be ment Kit, http://java.sun.com/products/jdmk/.
accessed by SNMP-based management applications. Sun Microsystem Inc. (1999), JavaBeans Specification
A set of SNMP APIs have been developed to sup- 1.0.1, http://java.sun.com/products/jdmk/.
port the development of the SNMP adaptor. Several
other tools have been developed to support the SNMP R. Shanmugam, R. Padmini, S. Nivedita. (2002), Spe-
adaptor, these include: a MIB compiler that automat- cial Edition: Using TCP/IP, 2nd Edition, Que.
ically generates MBeans representing a given SNMP
MIB; and a SNMP proxy service to allow non-SNMP Y. Yemini, G. Goldszmidt & Mitsuru Oshima (1991),
management applications to access the SNMP agent Network Management by Delegation, Interna-
using a variety of protocols. A simple example is also tional Symposium on Integrated Network Man-
given to illustrate the MBean generation process for agement.
a given SNMP MIB.

S-ar putea să vă placă și