6.0 Configuring Agent Settings

 


6.1 Overview
6.2 Configuring General Settings

6.2.1 SNMP Version
6.2.2 Compliance to Standards

6.2.3 Target, Community and Notification MIB Support
6.2.4 Port Settings
6.2.5 Debug Level
6.2.6 Mode
6.2.7 Transport Protocol

6.3 Configuring Source Generation Settings

6.3.1 Package Name / Agent Name
6.3.2 Instrument with Interface
6.3.3 Merge with Previous Stub Files
6.3.4 Synchronized Set Methods
6.3.5 Initialize with Default Values
6.3.6 Generate Trap on Set

6.3.7 Generate code for API Tables Info

6.4 Packaging the Agent

6.5 Configuring Root OID

6.6 Other options


 

6.1 Overview

 

MIB Compiler allows you to configure the Project from the User Interface (UI) itself. This configuration is done using the Settings panel invoked using any one of the following: (1) Project -> Settings menu option (2) Settings icon from the toolbar (3) Ctrl+Shift+S hot key.

 

This chapter describes various settings that can be configured while working with the Agent. The "General Settings" topic talks about some of the general parameters that need to be configured such as Version, Compliance to Standards, Port Settings, Logging level, Mode of Request handling, and Transport protocol to be used. The topic "Source Generation Settings" lists the various parameters required while generating code for the Agent.

 

6.2 Configuring General Settings

 

You can configure some general settings pertaining to your SNMP Agent project using Project ->Settings ->General option. The options provided are :-

The panel for configuring these parameters is shown:

 

6.2.1 SNMP Version

 

The supported SNMP Versions are :

 

Version 1 : Selecting this option will generate the Agent as SNMPv1 Agent.
Version 2 : Selecting this option will generate the Agent as SNMPv2c Agent.
Version 3 : Selecting this option will generate the Agent as SNMPv3 Agent, which supports USM as the default security model and VACM as the default access control model.

 

The default version selected is v3.

 

6.2.2 Compliance to Standards

 

The AdventNet SNMP Agent has implemented standard MIBs to provide SNMP v1, v2, and v3 compliance. By default, the implementations of these standard MIBs are added to the Agent depending upon the version selected, while generating the source code. If the standard MIB implementations need not be added to the Agent, de-select the options provided for Compliance.

 

6.2.3 Target, Community and Notification MIB Support

 

The option "Target, Community and Notification MIB Support" has to be enabled if Coexistence and Notification MIB support is required in a V3 Agent. Only if this option is enabled can the respective tables under SNMPv3 Panel be accessed.

 

6.2.4 Port Settings

 

The Agent Port option is used to specify the port at which the SNMP Agent, being developed, is to be started. By default, the SNMP Agent is started at port number 8001. You can specify any other port from which the Agent will be started. The Agent processes the request (from the Manager) from this port.

 

The Trap Sending Port is the port used by the Agent to send Traps to Managers. By default the Agent sends Traps through the port number 8002. You can specify the port from which the Agent has to send Traps, using the Trap port option.

 

6.2.5 Debug Level

 

When the Agent is running, it generates log messages for you to know about the Agent processing. These log messages are stored in a text file called agent.log. Each log message has an associated log Level. The Level gives a rough idea about the importance and urgency of a log message. You can select the level of log message to be recorded in the log file. Each of these Debug levels are explained in Logging in SNMP Agent section.

 

6.2.6 Mode

 

Asynchronous Message Processing enables the Manager to send many requests to the SNMP Agent simultaneously. By this, a lot of time is saved as the Manager need not wait for the response from the Agent for the previously sent message. Using Asynchronous Message processing also enables more than one Manager to access the SNMP Agent and get the processes done in parallel.

 

Asynchronous Message processing is achieved by using Multithreading. Every functionality of the SNMP Agent runs in a separate thread and can be accessed for Asynchronous Message processing.

 

Enabling Asynchronous Message Processing

 

Asynchronous Message Processing can be enabled either using MIB Compiler UI options or using API calls.

 

Using MIB Compiler UI

After enabling the Asynchronous Mode, the combo box for configuring the number of threads gets activated. You can configure the maximum number of threads that needs to be handled by the SNMP Agent for Asynchronous Message Processing.  Here you can increase or decrease the number of threads. The default number is 1 and the maximum number of threads that are permitted is 20.

 

Using API Calls

 

For running in async mode, add the following piece of code

in the Main file generated. By default the number of threads created will be one. And the maximum number of threads that can be handled is 20. This can be altered by calling super.setMaxThreads(int) in the Main file. This code gets generated, if async mode is set "true".

 

6.2.7 Transport Protocol

 

The Transport Protocol option in General panel of Project -> Settings menu specifies the communication protocol that will be used by the developed Agent.

 

TCP/IP

 

Selecting this option will use TCP/IP as the communication protocol.

    Note: The Agent developed using TCP/IP as the communication protocol cannot be tested using the MIB Browser. Please use Commandline applications  (TCP/IP) for testing. They are available in <Agent Toolkit Home>/examples/snmp/low_level_tcpapps directory.

UDP/IP

 

Selecting this option will use UDP/IP as the communication protocol. The default transport protocol used is UDP/IP.

 

6.3 Configuring Source Generation Settings

 

Source generation settings allow you to customize the Agent and make it respond as required. These settings relate to parameters required for generating java source files for the Agent. If these settings are not configured, MIB Compiler generates an Agent which responds with default values. These parameters can be configured using the General option of Source Generation panel invoked using Project ->Settings menu. The Storage Model option under the Source Generation Panel helps you to store the details of the Agent in a Text file, XML file or RAM. For more information refer to "Supported Storage Types Option".

 

This chapter describes how to configure the various parameters such as:

The panel for setting the above said parameters is shown in the screen shot below.

 

6.3.1 Package Name/Agent Name

 

Package Name

 

The Package Name provided in the Source Generation panel, will be taken as the package name for the generated Java files. The default package name provided is com.myCompany.myPackage. You can also specify any other name other than the default name provided.

 

Agent Name

 

The Agent Name provided in the Source Generation panel, refers to the Main File Name. By default, the Main file name gets generated as AdventNetSnmpAgent.java. You can specify any other name other than the default name.

 

6.3.2 Instrument with Interface

 

The AdventNet Agent Toolkit supports interface mode of code generation, if this option is enabled. For a scalar node/non-table group node, the Interface file will be generated as xxxInterface.java. For a columnar node/table node, the Interface file will be generated as xxxEntryInterface.java file. You have to implement this interface.

 

For example, the default code generated for AgentSystem group of AGENT-SAMPLE-MIB in the main file is given below:

In the above code, AgentSystemInterface instruments the new AgentSystemInstrument() which is the default file generated by the MIB Compiler. You can replace this with your own instrument file, say, MyAgentSystemInstrument(). Now, the code will look like this,

Thus, you need not edit any generated Java files from MIB Compiler. You also need not worry on migrating to releases (or) upgrading the MIB knowledge of SNMP Agent.

 

6.3.3 Merge With Previous Stub Files

 

On regenerating the source files, the  newly generated files will be over written or will not be modified. The information that you added will be lost if it is overwritten. To avoid this and merge your code with the newly generated code, you should select this option. By default, merge with stub files option is checked.

 

This option is used when you are moving from one version of the product to another version. If there is any change in the generated code, then using the Merge option you can merge your changes with the newly generated code of the MIB Compiler. If the merging is not proper, a new file is created and thus intimates you that the merging for that particular file could not be done due to certain errors.

 

For more information on Merging, please refer to the topic Code Merging in "Instrumenting the Generated Code" (8.0) section.

 

6.3.4 Synchronized Set Methods

 

The Synchronized set methods option in the Source Generation panel generates code with the set methods in the entry/instrument files as synchronized.  This  is extremely useful when running the Multiple Agents in a single JVM with the same stubs answering for requests on all the Agents.

 

6.3.5 Initialize All Variables to DEFVAL

 

This option, when enabled initializes all variables to the default values given in the MIB. If DEFVAL field is not present in the MIB then MIB Compiler will generate source code with default values based on data types.

 

For example, If Data Type is integer and DEFVAL is not present in the MIB, then MIB Compiler will initialize the variable to 1. For string type MIB Compiler will initialize the variable to "< node name > not initialized".

 

6.3.6 Generate Trap on Set

 

If the MIB has trap definition then the MIB Compiler will generate corresponding trap functions in the "AdventNetSnmpAgentTrap.java" file. On calling this function the corresponding trap will be sent to the registered Managers. This function can be called from anywhere in the Agent.

 

If the Generate Trap on Set option in the Source Generation panel of Project -> Settings menu is selected, then the MIB Compiler will generate code fragment in the set method of the handler file of the each trap variable. Thus, a trap is sent on every SET operation performed on the trap variable. If this option is not selected, then the code fragment will not be generated in the handler file.

 

Trap variable is one of the objects defined in the trap or notification construct of the MIB. Hence, it is required to define the trap type or notification type before generating traps on SET.

 

6.3.7 Generate Code for API Tables Info

 

This option enables the provision to get the api table info from the Main Agent. To know the necessity of this option please refer to the section "Provision for Getting the API Table Info" (Section 17.0).

 

6.4 Packaging the Agent

 

When an SNMP Agent is generated, the code for the Agent is generated in the <Agent Toolkit Home>/snmpProjects/<projectName>/agent/src directory. But some library files required for running the Agent are accessed from folders in <Agent Toolkit Home> directory.

 

When the Package Agent option is selected from the Build menu, the required binaries are copied into <Agent Toolkit Home>/snmpprojects/<projectName> directory. This makes the Agent self-contained and it can be used as an independent project. The Agent project is made available as a zip file and thus it can be run in any environment.

 

The changes that occur when this option is selected are:

6.5 Configuring Root OID

 

Root OID of a MIB can be changed after generating the code for an Agent. By modifying the root oid, the Agent is accessed from that particular oid. It is not necessary that you have to stick on to an oid that is already present in the MIB. To configure the Root OID, use the API call given below.

 

Using API calls

 

Add the following piece of code in the generated Main file, below the code for traplistener.addRegistrationListener.

 

hdlr.setRootOid(required root, existing root);

 

For example, if the existing root is .1.3.6.1.2.1 and you prefer to change this to .1.3.6.1.7.2 this feature can be used. These root oids have to be specified in the above said code and after compilation and you will be able to access the Agent only with the root oid .1.3.6.1.7.2 thereafter. The required root OID and existing root OID are to be represented as a String OID.

 

6.6 Other Options

 

Following options present under the Project -> Settings menu are discussed in the topics mentioned below.

 

Options Topic

Storage Model options in Source Generation Panel

discussed under the topic Supported Storage Types for Scalars and Tables (Section 16.0).

V1V2 Authentication Panel

discussed under the topic Authenticating SNMPv1/v2c Requests (Section 10.0)

Proxy

discussed under the topic Implementing SNMP Proxy (Section 13.0)

Trap

discussed under the topic Sending Traps & Informs (Section 12.0)

SNMPv3

discussed under the topic Configuring SNMPv3 Agents (Section 14.0)

Compile Options

This panel shows the jars used in the classpath of the Project. The jars used by default are listed out. You can add or remove a jar based on your requirement.