|
15.1 Master - Subagent Architecture in Multi-Protocol : An Overview
15.2 The Cascader Service MBean
15.3 Creating the Cascading Service MBean in the Master Agent
15.4 Starting the Cascader Service MBean
15.5 Cascader Service MBean Attributes
15.6 Cascading Service Functionality
15.7 Running the Cascader Service Example
15.1 Master - Subagent Architecture in Multi-Protocol Agent : An Overview
It is easy to manage a large number of agents when they have a hierarchical structure of master agents and subagents. Managers communicate only with the master agents and access the subagents transparently, as if the information actually resided in the master agent. This Master - Subagent architecture in JMX can be achieved in three ways :
Using the Cascader Service MBean when the subagent is a RMI/CORBA/HTTP agent
Using JMX SNMP Proxy when the subagent is a SNMP agent
Using SNMP Proxy (Note: This feature would be applicable only if SNMP Adaptor is instantiated in the master-agent and the sub-agent is a Multi-Protocol agent with SNMP Adaptor or a standalone SNMP agent. The MBean server is eliminated in this transaction. The communication medium between the master-agent and the sub-agent is SNMP.)
AdventNet SNMP Adaptors can be used as subagent to Third-party agents (including OS Native agent). For more details, refer Making AdventNet Agents as Subagents to Third-Party Agents (including OS Native agents) from Implementing SNMP proxy of Building SNMP Agent section.
This topic deals with Master - Subagent Architecture in Multi-Protocol Agent using the Cascader Service MBean.
15.2 The Cascader Service MBean
Master Agent : The agent whose MBean server contains an active cascading service is called a master agent in relation to the other agent which is mirrored. Master agents concentrate and relay the information in their subagents and can provide their own specific information as well.
Subagent :The agent to which the cascading service is connected is called the subagent in relation to its master agent.
A Master agent can have any number of subagents, each controlled individually by a different Cascader MBean. The Cascader service can work with RMI, CORBA and HTTP protocols.
The cascading service allows you to access the MBeans of a subagent directly through the MBean server of the master agent. The cascader service can be configured to use RMI, CORBA or HTTP protocol to connect with the subagent. There will be a cascader MBean instance per subagent configured with subagent's host:port.
Figure 1: AdventNet Cascading service architecture
For each of the subagent’s MBeans, the cascading service instantiates a mirror MBean that is registered in the master agent. The mirror MBeans are actual MBean objects registered in the master agent’s MBean server with the same object name. All attributes, operations, and notifications may be accessed through the mirror MBean. The mirror MBean forwards all management requests through the cascading service to the corresponding MBean in the subagent.
The cascading service is dynamic, i.e., whenever MBeans in a subagent are registered or deregistered, mirrored MBeans get registered or deregistered.
15.3 Creating the Cascading Service MBean in the Master Agent
A Cascader Service MBean is created for every subagent you wish to manage through the master agent. This can be done from the JMX Compiler UI or using the API.
Using JMX Compiler UI
A cascader service MBean is created for each subagent entry. A subagent entry can be added using JMX Compiler UI, as given below:
Select Project -> Settings option. In the Settings Tree Structure, select AdventNet Services -> Cascader Service, which displays the Cascader dialog on the right side.
Select the Add option, which displays the Entry Parameters for the subagent. Here, you can specify the following details :
The subagent host IP Address or name.
The port number at which the subagent is running.
The Protocol used by the subagent - RMI/CORBA/HTTP.
The timeout value to receive a response from the subagent.
Click the OK button to add the subagent entry to the Cascading Table.
Similarly, you can add any number of subagent entries in the Cascading Table.
Using API :
The following code snippet, added in the main file, creates a cascader service MBean for a subagent running at localhost with port number 1099, using RMI protocol.
|
// add the following import statement Cascader cascader_0 = new Cascader("localhost",1099,"RMI"); name = "Services:type=Cascader,name=Cascader_0; server.registerMBean(cascader_0, new ObjectName(name)); cascader_0.startService(); |
Similarly, you can add any number of subagent entries, by adding the given code snippet for each subagent . The subagent host name, port number, and protocol used must be configured in the code.
15.4 Starting the Cascader Service MBean
To start the Cascader Service MBean we have to explicitly call the startService method of the Cascader MBean after which the MBeans of subagent will get reflected under Master Agent. The subagent should be started beforehand with the protocol with which we want to communicate our cascader to subagent. It can also be started in the following ways :
From the manager (MBean Browser) by connecting to the Master Agent and invoking the startService operation of Cascader MBean listed in the Services Domain.
From the API, by calling the startService() method of the corresponding Cascader MBean.
Once the cascader service is activated the MBeans in the subagent are mirrored in the master agent. For example, lets say the subagent1 (running in 'localhost' with RMI adaptor at port 1099) has 2 MBeans registered with it with below object names:
SubAgent1:type=MBean5
SubAgent1:type=MBean6
When the cascader service corresponding to subagent1 is activated :
The cascader service will use Agent Toolkit client API to connect to the subagent1 using RMI. Thus cascader in RMI client role will know the MBeans and its object names in subagent1.
This cascader service instance will register itself with the master agent for the above 2 MBean object names.
Request Handling: When manager queries the master agent for SubAgent1:type=MBean5, the query reaches the cascader service instance (since it has registered for this objectname). This cascader service instance will proxy the request to the subagent1 using RMI. Get the response from the subagent1, which will be sent as response to the manager.
Notification handling: The cascader service will register with the subagent1 as NotificationListener for remote notifications. Any notifications emitted by the MBeans in the subagent1 will be propagated to cascader service by the subagent1 protocol adaptor (here, RMI adaptor). After receiving the notifications the cascader service acting in NotificationBroadcaster role will broadcast the notification to its notification listeners. The protocol adaptors in the master agent are listeners for all the notification broadcaster mbeans in the local agent (master agent). Hence the protocol adaptors in master agent will receive the notifications send by the cascader service and notifies to the managers.
15.5 Cascader Service MBean Attributes
Exposing Writable Attributes
The Cascader MBean exposes three writable attributes : the subagent host, port, and protocol. Neither of these attributes may be modified when the cascading service is active. In order to start the service with different host, port and protocol, we must first do the stopService operation of cascader mbean from any of the browsers. This disconnects masteragent from the subagent thereby all the mirrored mbean taken from subagent will be removed. After modifying the port number or protocol of the subagent, we have to start the service by doing startService operation of CascaderMbean. Now you could see the list of all MBeans mirrored from specified subagent.
Exposing the Readable Attributes
The Cascader MBean exposes three readable attributes: the state of the Cascader MBean (Active/Inactive), the total number of Remote Objects in the Subagent, and the list of Remote Objects.
When the cascading service is stopped or its MBean is removed from the master agent, all of its mirror MBeans are deregistered.
15.6 Cascading Service Functionality
Adding or removing an MBean in the master agent will trigger a notification that any cascading service connected to the master agent will receive.
When an MBean is unregistered from the subagent, the cascading service MBean removes its mirror MBean from the master agent.
When a new MBean is registered in the subagent, the cascading service instantiates its mirror MBean, sets up its connection to the new MBean, and registers the mirror with the master agent’s MBean server.
Mirror MBeans are registered in the master agent with the same object name as the mirrored MBean in the subagent.
Any changes in the subagent’s MBeans are automatically applied to the set of mirror MBeans, to ensure that both master agent and subagent remain consistent.
15.7 Running the Cascader Service Example
Please refer the Cascader Example present in the <Agent Toolkit Home>/example/jmx/cascader directory. This is a simple example to illustrate the usage of Cascading service provided by the XMOJO JMX implementation. This creates a Master-Sub agent architecture in JMX.
The Readme.html file explains the usage of the example and the steps involved in running the example.
|