Java Dynamic Management Kit 5.0 Tutorial

MIB Overlapping in Master Agents

In the overlapping MIB master agent example, proxy registration is identical to standard MIB registration and the proxies are created in the same way as for SNMPv1 and v2 master agents.


Example 21–4 Overlapping MIBs MasterAgent Example

		 // Instantiate a Mib
	    //
	    final MIB1_MIB mib1 = new MIB1_MIB();
	    
	    // Register the local MIB1 implementation for sysDescr1 
	    // and sysDescr2.
	    //
	    final SnmpOid oid1 = new SnmpOid("1.3.6.1.2.1.1.1");
	    final SnmpOid oid2 = new SnmpOid("1.3.6.1.2.1.1.2");

	    // Make an array of these OIDs.
	    //
	    final SnmpOid[] local_oids = {oid1, oid2};

	    // Add the local MIB1 implementation for each redefined oid
	    //
	    snmpAdaptor.addMib(mib1, local_oids);
	    
	    // Initialize the mib
	    //
	    mib1.init();

The overlapping MIB MasterAgent example for of all creates a new MIB using new MIB1_MIB. It then registers the local MIB1 implementation for sysDescr1 and sysDescr2, which are configured into the StandAloneAgent example as error1 and error2, respectively. The local MIB thus shadows the implementation of sysDescr1 and sysDescr2 instrumented in the remote MIB, because it is registered with deeper OIDs than the remote MIB.

The MIBs are then added to the SNMP adaptor server using snmpAdaptor.addMib and inititialized using init().