4.0 Creating a Simple Multi-Protocol agent Using JMX Compiler

 


4.1 Overview

4.2 Creating a New Project

4.3 Loading MIB in JMX Compiler

4.4 Generating Code for the MIB

4.5 Compiling the Generated Code

4.6 Starting and Stopping the Agent


 

4.1 Overview

 

This chapter  guides you through a step-by-step procedure to create, compile, and run a simple Multi-Protocol agent. This agent will be created based on the default options provided in the JMX Compiler with support for SNMP, HTTP, TL1, RMI, CORBA, and HTML adaptors.With this agent, you will be able to retrieve the default values provided in the agent.

 

4.2 Creating a New Project

 

Please follow the steps given below to create a new project for the simple Multi-Protocol agent :

The JMX Compiler settings is saved in the <ProjectName>.prj file, which is created for each project in the specified directory. Hence, you can open a particular project anytime with its current settings by selecting the workspace of that project.

 

4.3 Loading MIB in JMX Compiler

 

On creating a new project,  the workspace dialog opens with the MibView Tab enabled. Please follow the steps given below to load a  MIB in the JMX Compiler, for the simpleJMXProject created above:

You will find the MIB displayed as a tree in the top panel of the workspace dialog. The Settings Menu provides various options based on which code is generated.  In this example, you implement the simpleJMXAgent with default options.

 

Note: You can use MIB Editor to create your own Mib File.  MIBs created by other sources can also be used to  generate code in the JMX Compiler.  To know about the steps involved in defining MIBs using MIB Editor, please refer to the topic Defining a MIB

 

4.4 Generating Code for the MIB

 

Please follow the steps given below to generate code for the AGENT-SAMPLE-MIB. The generated code will be based on the Model MBeans specified by JMX specification.

  1. >Select the Build->Generate Source option or the  generate icon on the toolbar, which generates source files corresponding to the AGENT-SAMPLE-MIB.

  2. The Debug window opens and displays information about the generated source files under the projects directory. After the code generation, it says Code generation succeeded for project : simpleJMXAgent.prj.

  3. The files are generated in <Agent Toolkit Home>/jmxprojects/simpleJMXAgent/agent/src directory.

  4. You can  also view the files generated for the project in the Fileview Tab of the WorkSpace dialog.

4.5 Compiling the Generated Code

 

After generating the code for the loaded MIB file(s), the next step in agent development is compiling the source code. You can instrument the source code according to your requirements before compilation. In this example, you compile the source code without any instrumentation. Compiling the generated code can be done either from the JMX Compiler UI  or from the Command prompt.

 

From JMX Compiler UI

 

Follow the steps given below to compile the generated code from the JMX Compiler UI.

From Command Prompt

 

You can also compile the source from the command prompt. Please follow the steps given below to compile the source files from the command prompt.

      Note: Before executing javac, update the PATH variable, if you want to run the SDK executable javac.exe conveniently from any directory. To know how to set the path variable, please refer to Troubleshooting- General Section

The above command compiles all the files under agent/src directory. If the compilation is successful, the compiled class files can be found under jmxprojects/simpleJMXAgent/agent/bin directory.

 

Now, all the files have been compiled and the simpleJMXAgent can be started.

 

4.6 Starting and Stopping the Agent

 

After successfully compiling the Multi-Protocol agent, you can start the Agent either from the JMX Compiler UI or from the Command prompt as explained in the proceeding sections.

 

Starting and Stopping the Agent from JMX Compiler UI

Starting and Stopping From the Commmand Line

 

Follow the steps given below to start  Agent from the command prompt.

Now that the Agent is developed and started, the next step is to test the Multi-Protocol agent  by sending SNMP, HTTP, TLI, RMI, CORBA & HTML requests using the respective protocols. To know how to perform Testing on the Multi-Protocol agent, please refer to Testing the Multi-Protocol agent section.

 

 
 

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