[SNMP4J] SNMP V2 Trap Problems

Leonard Bocock leonard.bocock at gmail.com
Wed Aug 29 09:52:48 CEST 2007


List,

V1 trap sends are working fine to both NetView and the snmpj4 agent, however
I seem unable to resolve V2c trap send problems despite much effort.

When received by Netview 7.14, I get invalid trap format errors in
trapd.logalthough I don't necessarily trust that product!

When sending to snmpj4 agent, running the command line "SNMP4J  -Ol
0.0.0.0/162", I get the following error:

29/08/2007 19:50:00 org.snmp4j.log.JavaLogAdapter log
SEVERE: java.io.IOException: Unsupported PDU type: -89

I can't help but think I'm missing something basic here, but have no idea
what.....as far as I can tell the PDU is set right, var1=sysTime and var2
the OID,

Here is the relevant code snippet.....


CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString(getElementText(community)));

PDU pduRequest = new PDU();
pduRequest.add(new VariableBinding(SnmpConstants.sysUpTime, new
TimeTicks(5666)));
pduRequest.add(new VariableBinding(SnmpConstants.snmpTrapOID, new
OID(sEnterprise)));

pduRequest.setType(PDU.TRAP);

Address address = new TcpAddress(InetAddress.getByName(sHostname), iPort);
AbstractTransportMapping transport = new DefaultTcpTransportMapping();

target.setAddress(address);
Snmp snmp = new Snmp(transport);
snmp.listen();

ResponseEvent responseEvent = snmp.send(pduRequest, target);

etc etc................

Any help gratefully received, Thanks Len



More information about the SNMP4J mailing list