What is SNMP in Java?Hoe to execute code related to this?
hey frndz can anyone tell me
What is SNMP in java?
How to execute the program to display MIB node information using com.adventnet.snmp.mibs package
The code is as follows to find MIB node infomation
Code :
import com.adventnet.snmp.snmp2.*;
import com.adventnet.snmp.mibs.*;
import java.io.*;
public class MibNodeInfo {
public static void main(String args[]) {
if( args.length < 2)
{
System.out.println("Usage : java MibNodeInfo mibfile OID ");
// System.exit(0);
}
// Take care of getting OID and the MIB file name
String mibfile ="RFC1213-MIB";
String OID = "10.3.2.120 1.2.0";
// load the MIB file
MibOperations mibops = new MibOperations();
try {
mibops.loadMibModules(new File(mibfile));
// mibops.loadMibModules(mibfile);
} catch (Exception ex){
System.err.println("Error loading MIBs: "+ex.getMessage());
}
// add OIDs
SnmpOID oid = mibops.getSnmpOID(OID);
MibNode node = mibops.getMibNode(oid);
if(node == null)
{
System.out.println("Invalid OID / the node " + oid + " is not available");
}
else
{
System.out.println("Syntax:"+node.getSyntax()+"/n"+
"Access:"+node.printAccess()+"/n"+
"Status:"+node.getStatus()+"/n"+
"Reference:"+node.getReference()+"/n"+
"OID:"+node.getNumberedOIDString()+"/n"+
"Node:"+node.getOIDString()+"/n"+
"Description:"+node.getDescription()+"/n");
}
}
}
Do it requires any other s/w other than java
plz help