Context Based Dynamic Registration

Introduction:

This application allows subagents to dynamically register with the master agent. Uses SNMP for the master subagent linkage (Relaying). Proxies requests to Subagents based on the Community and OID with which the subagent is registered to the master agent in the contextBasedProxyTable of AGENT-SNMP-CONFIG MIB.

Overview:

This example is generated with contextBased proxy enabled in the MibCompiler->Project -> Settings->Proxy panel. The SubAgent details are configured in the contextBasedProxyTable are as shown in the below Table,

S.No
Oid
ContextName
Host
PortNumber
Version
Community
Timeout
Retries
RowStatus
1
.1.3.6.1.2.1
public
localhost
8010 2
public
4000
0
1
2
.1.3.6.1.2.1.2
auth
localhost
8010 2
public
4000 0
1


In this case master agent can be run at any port and the subagent should be started at 8010. So the query for the OID under .1.3.6.1.2.1 group with public as community will be forwarded to the subagent. Similarly a V3 Request for the OID commin under .1.3.6.1.2.1.2 (IfTable) with contextName as auth will be forwarded to the SubAgent.

Similarly we can also add some more entries in the proxytable with different communities and we can test more subagents. New row can be added either from the manager or through ProxyTable.xmlfile available under the
<Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\contextbased\agent\bin\conf directory.

Source files:

1. Master Agent:

MasterAgent.java

* DynamicRegistrationWithCommunity class is instantiated.

* Created instance is registered with PduRequestHandler.

2. SubAgent:

Subagent is generated for RFC1213 mib.

Compilation:

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

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

    This will compile the MasterAgent sources.

Starting the Agents:

1. Start the master agent from <Installation Directory>\WebNMS\JavaAgent\examples\snmp\proxy\contextbased\agent\bin directory using,

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

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

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

Now query the Interfaces group present in the RFC1213-MIB by giving public as community. The master agent will proxy the request to localhost, port 8010 if the community is public.

If you query the master agent with a V3 Request and contextname value as auth for the ItTable vairable, the Request will be proxied to the same subagent.
 

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