[SNMP4J] Need help sending an INFORM!!!

jo at atsresults.com jo at atsresults.com
Mon Oct 24 21:43:46 CEST 2005


Hey Everyone,

The code below is how I am sending a v3 trap to net-snmp.  

I would like to send an INFORM.  However, when I change the PDU type to INFORM
and call snmp.inform(pdu, target) it doesn't work.

I looked at the debug output from net-snmp and one of theses seems to be the
problem.

"
usm: USM processing begun...
trace: usm_parse_security_parameters(): snmpusm.c, 1872:
dumph_recv:     msgAuthoritativeEngineID
dumpx_recv:      04 00   // This doesn't look right

.....

Parsed SNMPv3 message (secName:, secLevel:noAuthNoPriv): USM unknown engineID
"

Isn't an INFORM and NOTIFICATION the same thing except an INFORM wants a
response?

Can someone help me out here?  Is there something more you have to do to send an
INFORM?  I know I am not looking for a response yet, but I want to make sure the
INFORM is received before I move to the next step.

This is very frustrating as my notifications work great, but the informs don't.
:-(

Thanks

========================================================================
OctetString MySecurityName = new OctetString("myuser");
OctetString localEngineID = OctetString.fromHexString("01:02:03:04:05");

Address targetAddress = GenericAddress.parse("udp:127.0.0.1/162");
TransportMapping transport = new DefaultUdpTransportMapping();

Snmp snmp = new Snmp(transport);

MPv3 mpv3 = (MPv3)snmp.getMessageProcessingModel(MessageProcessingModel.MPv3);

USM usm = new USM(SecurityProtocols.getInstance(), localEngineID, 0);  

SecurityModels.getInstance().addSecurityModel(usm);

// Add user to the USM
snmp.setLocalEngine(localEngineID.getValue(),0,0);
snmp.getUSM().addUser(	new OctetString("username"),new UsmUser(MySecurityName,
AuthMD5.ID, new OctetString("mypassword") , null, null));

// Create the target
UserTarget target = new UserTarget();
target.setAddress(targetAddress);
target.setVersion(SnmpConstants.version3);
target.setSecurityName(MySecurityName);
target.setSecurityLevel(SecurityLevel.AUTH_NOPRIV);
target.setRetries(1);
target.setTimeout(500);

// Create the PDU
TimeTicks uptime = new TimeTicks(1200);

PDU pdu = new ScopedPDU();
pdu.setType(PDU.NOTIFICATION);
pdu.add(new VariableBinding(SnmpConstants.sysUpTime, uptime));
pdu.add(new VariableBinding(new OID(SnmpConstants.snmpTrapOID),
SnmpConstants.coldStart));

// Send the PDU
snmp.notify(pdu, target);

System.out.println("Trap Sent");




More information about the SNMP4J mailing list