SNMP Proxy

 

AdventNet Multi-Protocol agent also supports the proxy function using the SNMP protocol, where requests for an OID sub-tree can be forwarded to another SNMP agent. This is implemented using the com.adventnet.snmp.snmp2.agent.SnmpProxy JavaBean.

 

 

The Proxy bean is useful in statically registering the subagents with the Multi-protocol Master agent (i.e the  SnmpAdaptor).It can only be used in registering the subagents during the Master agent start-up. The proxy works much the same as Dynamic Registration, except that the subagent's entries cannot be added dynamically. If your implementation does not require the subagents to be added dynamically, then SnmpProxy can be used.

The code for adding a proxy for mib-2 to host="localhost" and port=161 is shown below .
 

 

MBeanServer server =  MBeanServerFactory.createMBeanServer(); 
 SnmpAdaptor snmpadaptor = new SnmpAdaptor(); 

 String name =     server.getDefaultDomain()

 +":type=com.adventnet.adaptors.snmp.SnmpAdaptor,protocol=snmp,

 port=8001"; 

 server.registerMBean(snmpadaptor, new ObjectName(name)); 

 // Instantiate the SnmpProxy bean 
 com.adventnet.snmp.snmp2.agent.SnmpProxy 

 snmpProxy1 =  new com.adventnet.snmp.snmp2.agent.SnmpProxy(); 

 // setting the proxy host 
 snmpProxy1.setAgentHost("localhost"); 

 // setting the proxy port 
 snmpProxy1.setAgentPortNumber(161); 

 // setting the proxy registered OID 
 snmpProxy1.setRegisteredOid(".1.3.6.1.2.1"); 

 // Registering the proxy with the SnmpAdaptor 
 snmpProxy1.addRegistrationListener(snmpadaptor);