Writing a Java MIB browser : Using introduced concepts Different tools (ANTLR, JDMK…)
MIB Browser Application
SMICNG
SMICNG :
ANTLR :
Converts RFC to a specific format (MOSY)
ANTLR
Parser, creates data structures
Application in Java JDMK :
Java Application GUI swing
Java Dynamic Management Kit JDMK
Useful tool to create lexers, parsers, AST walkers in Java (or in C) High level language, avoid the low level parsing utilities Rules using RegExp Lexer and Parser
Sun Toolkit Agents and Managers Provides an API for accessing :
SNMP HTTP, HTTPS, RMI Scheduling, Monitoring
Architecture independent (Java !) MIB Compiler (not used in this project)
Very simple to use SNMP V1 to V3 Synchronous or Asynchronous Classes to describe requests, MIB objects, MIB OIDs etc… Browsable Javadoc with the API Can be used for agents or managers
Warning : Bug in the 1.1 compiler
SnmpOidTableSupport oidTable = new RFC1213_MIBOidTable(); SnmpOid.setSnmpOidTable(oidTable); SnmpPeer agent = new SnmpPeer(host, Integer.parseInt(port)); SnmpParameters params = new SnmpParameters("public", "private"); agent.setSnmpParam(params); SnmpSession session= new SnmpSession("SyncManager session"); session.setDefaultPeer(agent); SnmpVarBindList list = new SnmpVarBindList("SyncManager varbind list"); list.addVarBind("sysDescr.0"); SnmpRequest request = session.snmpGetRequest(null, list); boolean completed = request.waitForCompletion(10000); SnmpVarBindList result = request.getResponseVarBindList(); System.out.println(result); session.destroySession();
SnmpOidTableSupport oidTable = new RFC1213_MIBOidTable();
SnmpOid.setSnmpOidTable(oidTable) ;
The table class can be automatically generated Necessary to use this format
SnmpPeer agent = new SnmpPeer(host, Integer.parseInt(port)); SnmpParameters params = new SnmpParameters("public", "private"); agent.setSnmpParam(params);
High level interface As if it were local
SnmpSession session= new SnmpSession("SyncManager session");
session.setDefaultPeer(agent);
The session manages the requests and the reply
SnmpVarBindList list = new SnmpVarBindList("SyncManager varbind list"); list.addVarBind("sysDescr.0");
Allows to generate requests on multiple OIDs Generally used with only one element
Actual request. Can only be created from an existing session.
SnmpVarBindList result = request.getResponseVarBindList (); System.out.println(result); session.destroySession();
The results are added to the request object
Can load different RFC files
Can walk a branch of the tree Cache of previously fetched values
Need to be converted in MOSY by SmicNG
Table indexes reset is manual
Get, GetNext and Set Set was not tested Written in Java (architecture independent)
Table indexes: when to update ? String and physical addresses Problem of display on some OS or for remote connection.
Parse RFC directly (get rid off SmicNG) Support for trap messages Support for SNMP V3 Easier to implement than expected Versatility of JDMK
What tools can be used to make SNMP requests in Java ? How would you differentiate real strings from physical addresses if you had to implement a MIB Browser ?
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.