21.0 Running Multiple Agents in a Single JVM

 


21.1 Overview

21.2 Running Agents With Virtual IP Addresses in a Single JVM.

21.3 Running Agents With Multiple Ports in a Single JVM


 

21.1 Overview

 

As the name indicates, this section guides you through the steps involved in running Multiple Agents in a single JVM. Starting a JVM for each Agent accumulates a lot of resources. Hence, it is not preferred. For accessing Multiple Agents in a single JVM, each Agent should be configured with different ports or different virtual IP addresses. It is also possible to simulate a network using Multiple Agents.

 

21.2 Running Agents With Virtual IP Addresses in a Single JVM

 

The first step towards running the Agent in Virtual IP addresses is to configure the virtual IP addresses.

 

21.2.1 Configuring Virtual IP Addresses

 

This section explains how to configure Multiple IP Addresses in varied OS such as Linux, Solaris, Windows NT, and Windows 2000.

 

In LINUX

 

You can use the "linuxconf" tool provided by Linux OS to configure virtual IP Addresses.

In SOLARIS

For example,

 

ifconfig hme0:1 132.253.154.0 netmask 255.255.255.0 up

ifconfig hme0:2 132.253.154.1 netmask 255.255.255.0 up

 

After the configuration, check whether the driver for the Virtual IP Addresses is activated using ping.

 

In WINDOWS NT

 

The steps involved in configuring virtual IP addresses in a Windows NT OS are as follows:

    1. Click "Start" menu.

    2. This displays the "Settings" option in it.

    3. The "Control Panel" in settings menu provides the Network details.

    4. From the network properties, choose "Protocols Tab". It lists various protocols used by the OS.

    5. Select TCP/IP and view its properties.

    6. The Properties tab of the protocol has an "Advanced" tab in it which on clicking, displays the IP Address of the machine.

    7. The "Add" option helps to add more IP addresses to the machine.

    8. Specifying the IP Addresses here would help you start the Agents in various IP addresses.

In WINDOWS 2000

 

Follow the steps given below to configure the IP Addresses in a Windows 2001 OS.

    1. Click the Start menu.

    2. This displays the Network and Dial-up connection in the Control Panel.

    3. The dial-up connection has a New Connection facility and a Local Connection option.

    4. Selecting Local connection option provides tabs that can be configured.

    5. The Protocols tab in that option displays the protocols configured for the machine.

    6. Clicking TCP/IP's Advanced properties provides an option for Adding.

    7. This Add option helps to add more than one virtual IP address to the machine.

Activating the Agent in Virtual IP Address

 

Say you have configured virtual IP Addresses and created an Agent using AGENT-SAMPLE-MIB. The Main File of the Agent has the following code for the agent param options.

    public WebNMSSnmpAgent(String[] args){

    //this takes care of the options

    agentOptions = new AgentParamOptions( args);

    Thread th = new Thread(this);

    th.start();

    }

On adding a similar code and specifying the entry for virtual IP addresses, the Agent gets started in virtual IP Addresses.

 

    public WebNMSSnmpAgent (String ipAddress,

    String[] args){

    super (ipAddress);

    //this takes care of the options

    agentOptions = new AgentParamOptions(args);

    Thread th = new Thread(this);

    th.start();

    }

Please note that the following piece of code has to be included in the Main File (towards the end) to register the virtual IP Addresses.

    WebNMSSnmpAgent agent_sim3 = new

    WebNMSSnmpAgent ("192.168.200.1", args);

     

    WebNMSSnmpAgent agent_sim4 = new

    WebNMSSnmpAgent ("192.168.200.2", args);

    }

21.3 Running Agents With Multiple Ports in a Single JVM

 

For the Agent to run in different ports, add the following piece of code in the Main File generated.

 

public WebNMSSnmpAgent(int port, String[] args){

super (port);
//this takes care of the options

agentOptions = new AgentParamOptions(args);
Thread th = new Thread(this);
th.start();
}

 

The following code should also be included towards the end of the main file for the Agent to run at different ports.

Say you have an Agent created using AGENT-SAMPLE-MIB. To start it from the ports 8001, 8002 and 8003 include the following code in the Main file.

 

WebNMSSnmpAgent agent_sim = new AGENT_SAMPLE_MIB(8001, args);
WebNMSSnmpAgent agent_sim1 = new AGENT_SAMPLE_MIB(8002, args);
WebNMSSnmpAgent agent_sim2 = new AGENT_SAMPLE_MIB(8003, args);

 



Copyright © 2013, ZOHO Corp. All Rights Reserved.