[SNMP4J] Code for ----RE: SNMPv3_USM_UNKNOWN_SECURITY_NAME
Lin, Dongliang
dongliang.lin at boeing.com
Sat Oct 27 00:14:52 CEST 2007
Hi Frank,
If I have following two statements
snmp.getUSM().addUser(securityName, new UsmUser(securityName,
authProtocol, authPassphrase, privProtocol, privPassphrase));
snmp.listen();
for each request( instead of just once at setup_once()) then it works
with two SNMP sessions to two different targets
Why I have to do that on every single request ? I thought set it up once
will be enough.
Thanks a lot for your response.
Don
-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com]
Sent: Friday, October 26, 2007 10:15 AM
To: Lin, Dongliang
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Code for ----RE: SNMPv3_USM_UNKNOWN_SECURITY_NAME
Hi,
I do not think that this is related to SNMP4J. It seems rather a
synchronization problem in the application code, but I have to few
details to provide more help.
Best regards,
Frank
Lin, Dongliang wrote:
> Here is more details about my code and my problem.
> Any help is deeply appreciated.
>
> I have following code to run on two separate threads to send SNMPv3
> request to two separate agents with different security name It works
> fine if I just run one thread to either of Agents.
> However, with two threads, I got about 10% of response PDU is null and
> error code as:
> "org.snmp4j.MessageException: Message processing model 3
returned
> error: 1404"
>
> setup_once() /// init once
> {
> OctetString securityName = new OctetString("securityname");
> // different names for each agent
> int securityLevel = SecurityLevel.AUTH_NOPRIV
> OID authProtocol = AuthMD5.ID
> OID privProtocol = PrivAES256.ID;
> OctetString authPassphrase = new
> OctetString("authPassphrase "); // different phrasefor each agent
> OctetString privPassphrase = new OctetString("privPassphrase
> "); ; // different phrase for each agent
>
> transport = new DefaultUdpTransportMapping();
> snmp = new Snmp(transport);
>
> usm = new USM(SecurityProtocols.getInstance(), new
> OctetString(MPv3.createLocalEngineID()), 0);
> SecurityModels.getInstance().addSecurityModel(usm);
>
> snmp.getUSM().addUser(securityName, new
> UsmUser(securityName, authProtocol, authPassphrase, privProtocol,
> privPassphrase));
>
> UserTarget target = (UserTarget)tgt;
> target.setAddress(targetAddress);
> target.setRetries(requestMsg.targ.retries);
> target.setTimeout(requestMsg.targ.timeout);
> target.setVersion(target.getVersion());
> target.setSecurityName(securityName);
> target.setSecurityModel(SecurityModel.SECURITY_MODEL_USM);
> target.setSecurityLevel(securityLevel);
>
> snmp.listen();
> }
>
> SendRequest() // send out pdu to each agent per request
> {
> ScopedPDU pdu = new ScopedPDU(); // prepare pdu content ....
> snmp.send(pdu, target, reqObject, this);
> }
>
> Thanks in advance.
>
> Don at boeing
>
>> _____________________________________________
>> From: Lin, Dongliang
>> Sent: Wednesday, October 24, 2007 5:23 PM
>> To: 'snmp4j at agentpp.org'
>> Subject: SNMPv3_USM_UNKNOWN_SECURITY_NAME
>>
>>
>> Hello,
>>
>> Within one process, I can reliably poll individual SNMP/V3 agents.
>>
>> However with the same configuration, if I polling two different V3
>> agents at the same time through same process, I got about 10% error
>> response from those agents indicating PDUs are null.
>> The ResponseEvent shows the return error message as
>> "org.snmp4j.MessageException: Message processing model 3
returned
>> error: 1404"
>>
>> In USM.java, return SnmpConstants.SNMPv3_USM_UNKNOWN_SECURITY_NAME
>> which is 1404
>>
>> Any help are much appreciated.
>>
>>
>> Thanks.
>>
>> Don
>>
> _______________________________________________
> 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