Static proxy

Introduction:

This application will demonstrate how to register SubAgents without enabling dynamic registration and storage files(i.e., avoiding addition of a row to the proxytable from the manager at run time). Here, whatever the entry is added to the proxytable at startup, those entries only will be considered through out the agent running process.

-Uses SNMP for the master-subagent linkage (Relaying).
-Proxies requests to Subagents based on the oid with which the subagent is registered to the master agent in the ProxyTable at startup through API Calls.

Overview:

This example is generated with oidBased proxy enabled and Remote configuration option of proxytable disabled in the MibCompiler->Project -> Settings->Proxy -> oidBasedProxyTable. Subagent entry is added for oid(OID - .1.3.6.1.2.1.1 ) and the port as 8010 in ProxyTable. In this case the Master Agent can be run at any port and the Subagent should be started at 8010. So the query for the oid under the .1.3.6.1.2.1.1  group will be forwarded to the Subagent. Similarly you can also add some more entries in the proxytable with different oid and you can test more subagents. In this case new row to the subagent cannot be added from the Manager. i.e Addition of row to the proxy table is not possible at run time. It is possible to add the new row to the proxytable using API calls. Please note that it is also possible to have Static proxy implementation based on a storage file. To do this you will have to chose the corresponding constructor while instantiating the DynamicRegistration class. On doing so there will not be a need to add the entries through API Calls, the entries can be directly added to the storage file. But the Agent has to be restarted for the changes\additions to take effect.

Source files:

1. Master Agent:

MasterAgent.java

* DynamicRegistration class is instantiated without the storage option.

* Created instance is registered with PduRequestHandler with the Remote Configuration option disabled.

2. SubAgent:

Subagent is generated for RFC1213-MIB.

Compilation:

1. Go to <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\staticproxy\agent\bin directory and compile the source using,

    sh compile.sh (for Linux users) OR
    compile (for Windows Users)

Starting the Agents:

1. Start the Master Agent from <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\staticproxy\agent\bin directory by executing,

    sh run.sh (for Linux users) OR
    run(for Windows Users)

2. Start the subagent from <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\subagent\agent\bin directory using,

    sh run.sh (for Linux users) OR
    run (for Windows Users)

Now query any oid under .1.3.6.1.2.1.1 group present in the RFC1213-MIB. The Master Agent will proxy the request to localhost, port 8010 .
 

AdventNet oval logo
Copyright (c) 2009  ZOHO Corp. All Rights Reserved.