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.

    1. For setting multiple IP Addresses on an interface on a Linux system, you should have SUPER USER permission .

    2. Log in to SUPER USER and start the "linuxconf" tool after starting X-windows. ( just type linuxconf and press "Enter" ). The following tree will be displayed.

    + config

    + NetWorking

    + ServerTasks

    IP Aliases for virtual hosts

    + Control

    1. Enter at IP Aliases for virtual hosts.

    2. From the two interfaces eth0 / lo, assign the Virtual IP Addresses for physical interface eth0.

    3. After completing the configuration, reboot your machine for the changes to take effect.

    4. Upwards of 10,000 interfaces can be configured this way. If you are configuring a lot of interfaces it may take some time to boot up.

    5. We recommend using two interface cards on your linux system, and using it as a router. Set the virtual interfaces up on the interface not connected to your LAN. From other systems on your LAN, you can set the linux system as the router to get to the newly configured networks. Solaris refers to these as logical interfaces.

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:

In WINDOWS 2000

 

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

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.

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

 

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.

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 AdventNetSnmpAgent(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.

 

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

 



Copyright © 1996-2004, AdventNet Inc. All Rights Reserved.