[SNMP4J] Problem Sending SNMP V3 Trap
Frank Fock
fock at agentpp.com
Fri Jun 9 12:09:53 CEST 2006
Hi,
For SNMPv3 you have to use UserTarget instead of CommunityTarget
and you will have to configure the USM with the user you
are using to send the trap.
Regards,
Frank
Napachara Rattanavilai wrote:
> want sending trap(SNMPV3). It's not work but I used SNMPV1 and SNMP V2
> --> It's work.
> This Code :
> Address targetAddress = GenericAddress.parse("udp:127.0.0.1/162");
> CommunityTarget target = new CommunityTarget();
> target.setCommunity(new OctetString("public"));
> target.setAddress(targetAddress);
> target.setVersion(SnmpConstants.version3);
>
> ScopedPDU pdu = new ScopedPDU();
> pdu.setType(ScopedPDU.TRAP);
>
> DefaultUdpTransportMapping udpTransportMap=new
> DefaultUdpTransportMapping();
>
> pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID,
> SnmpConstants.linkDown));
> try {
>
> Snmp snmp = new Snmp(udpTransportMap);
>
> ResponseEvent response = snmp.send(pdu, target);
> System.out.println("pdu:"+pdu);
> System.out.println("response:"+response);
> snmp.close();
> } catch (Exception e) {
> e.printStackTrace();
> }
> Exception :
> org.snmp4j.MessageException: Message processing model 3 returned error:
> -1402
> at
> org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:420)
> at org.snmp4j.Snmp.sendMessage(Snmp.java:970)
> at org.snmp4j.Snmp.send(Snmp.java:794)
> at TestSNMPTrap.sendV3(TestSNMPTrap.java:117)
> at TestSNMPTrap.main(TestSNMPTrap.java:50)
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list