HOME | PRODUCTS | DOWNLOAD | SALES | SUPPORT | ABOUT US

 
Koshna SNMP Manager Toolkit
Overview
Technical Description
Usage
API Documentation
Download
Purchase

Koshna SNMP Manager Toolkit

Configuring the SNMP protocol Stack for a SNMP Manager

A simplified block diagram of the architecture of the stack for an SNMP Manager implementation is shown below.

SNMP Manager

To configure the SNMP protocol stack for a SNMP manager.

  • Create the Transport Layers.
  • Create a SNMP Manager Dispatcher and associate the transport layers with it.
  • Create the SNMP Protocol Engines for the different SNMP versions(V1, V2c & V3) and associate them with the Dispatcher.
  • Initialize the internal MIBs.
  • Create the Security Module & associate it with the Protocol Engine(only V3 engine supports this).
  • Create the Access Control Modules and associate them with the Command Responders as needed ( Currently there are implementations for Community based access control and View based access control with the later giving more fine grained control).
  • Start the Dispatcher.
  • Create a SNMP Session.
  • Create the MIB Proxy objects and associate them with the SNMP Session.
  • Send the requests.

For example, here is some sample code:

...

// Create a Transport Layer

IPTransportLayer tpLayer = new IPTransportLayer(161,2048);

// Create a SNMP Agent Dispatcher and associate the transport layer with it.

dispatcher = new SnmpManagerMTDispatcher(2,2,tpLayer);

// Create Protocol Engines &associate them with the dispatcher

SnmpV3ProtocolEngine pe = new SnmpV3ProtocolEngine(new byte[] {(byte)0x80, 0x00, 0x00, 0x02, 0x01, 0x09, (byte)0x84, 0x03, 0x01});

// Initialize the internal MIBS

InternalMibs internalMibs = new InternalMibs(".\\config\\snmp.conf");

// Create a Access Module

VACMImpl vacm = new VACMImpl(internalMibs.getVacmMibHelper());

// Create a Security Module

USMImpl usm = new USMImpl(internalMibs.getUsmMibHelper());

System.out.println("Registering the v3 protocol engine...");

// Associate the security module with the V3 protocol engine

pe.addSecModule(usm);

dispatcher.registerSnmpProtocolEngine(pe);

dispatcher.registerSnmpProtocolEngine(new SnmpV1ProtocolEngine());

dispatcher.registerSnmpProtocolEngine(new SnmpV2cProtocolEngine());

// Start the dispatcher

dispatcher.start();

// Create the SNMP Session

SnmpIPPeer peer = new SnmpIPPeer("127.0.0.1",161);

SnmpV3Parameters params = new SnmpV3Parameters();

params.setSecurityModelNumber(usm.getSecModelNumber());

params.setRemoteEngineID(new byte[] {0x10,0x01});

params.setUserName("user1".getBytes());

params.setSecurityLevel(new SecurityLevel(SecurityLevel.AUTH_PRIV ));

SnmpV3Session session = new SnmpV3Session(dispatcher, peer, params);

session.discoverRemoteEngineID();

session.discoverRemoteEngineTime();

// Create the MIB Proxy objects

HOST_RESOURCES_MIBProxy mibProxy = new HOST_RESOURCES_MIBProxy();

 mibProxy.init();

// Associate the proxies with the session.

mibProxy.setSnmpSession(session);

// get values from remote agent.

mibProxy.snmpGetAll();

System.out.println("MibProxy = " + mibProxy.toXML());

...

The SNMP Manager dispatcher can be multi-threaded in which case you can decide how may threads will be assigned to receive packets & decode them(SNMP Packet Processors) and how many to create SNMP messages (SNMP Message Processors) and send them out.Besides, One thread each will be assigned to the Transport Layer modules.