Hello Everyone,

I'm working on developing an SNMPv3 based NMS software for a Licensed Band 
cellular Radio Backhaul, using SNMP4J. My major concern in this project is to 
do both, manager as well as the agent part.

Being a beginner, I'm facing problem with the installation of the software 
itself. 


I downloaded snmp4j-agentx-1.3.1a , currently working on Windows XP platform 
and 
trying to execute them over the simple command prompt of Windows (Will be 
working over Eclipse IDE later).

Since there was no online help available regarding the installation steps of 
this software, i tried n number of open forums which gave me the idea that 
certain .jar files were to be executed. However, no matter what i tried, all I 
got were Class Manifest errors. or, NoClassDef errors. This led to more 
confusion, resulting in multiple copies of the extracted 
snmp4j-agentx-1.3.1a folder at various locations. Also, is there a particular 
sequence in which these files are to be compiled/executed. 


I also made a simple test code that should make a PDU and sned it successfully. 
Since i can't execute and check it, i 'm a bit doubtful about it too.

// checking for a simple request pdu and endinng it.
import java.io.IOException;
import java.util.List;
 
import org.snmp4j.CommunityTarget;
import org.snmp4j.scopedPDU;
import org.snmp4j.Snmp;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.transport.DefaultUdpTransportMapping;
public class send 
{
 /**
  * @param args
  */
 public static void main(String[] args) 
 {
     //To setup a default SNMP session for UDP transport
     Address targetAddress = GenericAddress.parse("udp:127.0.0.1/161");
     TransportMapping transport = new DefaultUdpTransportMapping();
     snmp = new Snmp(transport);
     USM usm = new USM(SecurityProtocols.getInstance(),
                       new OctetString(MPv3.createLocalEngineID()), 0);
     SecurityModels.getInstance().addSecurityModel(usm);
     transport.listen();
     
     // add user to the USM
     snmp.getUSM().addUser(new OctetString("MD5DES"),
                           new UsmUser(new OctetString("MD5DES"),
                                       AuthMD5.ID,
                                       new 
OctetString("MD5DESUserAuthPassword"),
                                       PrivDES.ID,
                                       new 
OctetString("MD5DESUserPrivPassword")));
     // create the target
     UserTarget target = new UserTarget();
     target.setAddress(targetAddress);
     target.setRetries(1);
     target.setTimeout(5000);
     target.setVersion(SnmpConstants.version3);
     target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
     target.setSecurityName(new OctetString("MD5DES"));
     // create the PDU
     PDU pdu = new ScopedPDU();
     pdu.add(new VariableBinding(new OID("1.3.6")));
     pdu.setType(PDU.GETNEXT);
     // send the PDU
     ResponseEvent response = snmp.send(pdu, target);
     if(response.getResponse()== NULL)
     {
      System.out.println("Request Timed out!!!");
      exit();
     }
     // extract the response PDU (could be null if timed out)
     PDU responsePDU = response.getResponse();
     // extract the address used by the agent to send the response:
     Address peerAddress = response.getPeerAddress();
   
 }}


      
_______________________________________________
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j

Reply via email to