Hi,

 

I am getting "Incorrect Version or decode error" on manager side. I was
just wondering if there is something missing with the following sample
trap sender code.

 

 

public class SampleTrapSender {

 

            public static void main(String[] args) {

                  String address = "172.27.41.101";

                  String port = "162";

                  address = address + "/" + port;

                  System.out.println("Target adddress ...." + address);

                  

                  try{

                        Snmp snmp = new Snmp(new
DefaultUdpTransportMapping());

                        PDU trap = new PDU();

                        trap.setType(PDU.TRAP);

                        OID oid = new OID("1.3.6.1.4.1.4976.2.1.1.0");

                        Variable var = new OctetString("Test Message");

                        

                        trap.add(new VariableBinding(oid, var));

 

                        

                        Address targetAddress = new UdpAddress(address);

                        CommunityTarget target = new CommunityTarget();

                        target.setCommunity(new OctetString(""));

                        target.setVersion(SnmpConstants.version2c);

                        target.setAddress(targetAddress);

                              

                        snmp.send(trap, target, null, null);

                        System.out.println("DONE......");

                        

                  }catch(IOException exception){

                        exception.printStackTrace();

                  }

                  

 

            }

}

 

 

 

Thanks in advance,

Abhijit Salunkhe

 


"Legal Disclaimer: This electronic message and all contents contain information 
from Cybage Software Private Limited which may be privileged, confidential, or 
otherwise protected from disclosure. The information is intended to be for the 
addressee(s) only. If you are not an addressee, any disclosure, copy, 
distribution, or use of the contents of this message is strictly prohibited. If 
you have received this electronic message in error please notify the sender by 
reply e-mail to and destroy the original message and all copies. Cybage has 
taken every reasonable precaution to minimize the risk of malicious content in 
the mail, but is not liable for any damage you may sustain as a result of any 
malicious content in this e-mail. You should carry out your own malicious 
content checks before opening the e-mail or attachment."
www.cybage.com 


_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j

Reply via email to