* @(#)GetRowData.java * Copyright (c) 2012 ZOHO Corp. All Rights Reserved. * Please read the associated COPYRIGHTS file for more details. */ /** * This is an example program to explain how to write an application to get * the second row of the sample table if the column oids are .1.3.6.1.4.1.2.2.1.1, * .1.3.6.1.4.1.2.2.1.2, .1.3.6.1.4.1.2.2.1.3 by using * com.adventnet.snmp.snmp2 package of WebNMS SNMP API. * * The user could run this application by giving the following usage. * * java GetRowData * * import java.lang.*; import java.util.*; import java.net.*; import com.adventnet.snmp.snmp2.*; public class GetRowData { public static void main(String args[]) { // Start SNMP API SnmpAPI api = new SnmpAPI(); // Open session SnmpSession session = new SnmpSession(api); try { session.open(); } catch (SnmpException e ) { System.err.println("Error opening socket: "+e); } // Build Get request PDU SnmpPDU pdu = new SnmpPDU(); UDPProtocolOptions option = new UDPProtocolOptions("localhost"); pdu.setProtocolOptions(option); // get the OIDs SnmpOID[] oids=new SnmpOID[3]; oids[0]=new SnmpOID(".1.3.6.1.4.1.2.2.1.1.6"); oids[1]=new SnmpOID(".1.3.6.1.4.1.2.2.1.2.6"); oids[2]=new SnmpOID(".1.3.6.1.4.1.2.2.1.3.6"); // Send PDU and receive response PDU for(int i=0;i