[SNMP4J] Code for ----RE: SNMPv3_USM_UNKNOWN_SECURITY_NAME

Eugene R. Snider gene at cvtt.net
Sat Oct 27 01:59:23 CEST 2007


Do you have this function defined as synchronized? I would also consider 
adding a global value to indicate that it has run and
putting the functionality inside a conditional.

private static boolean hasRun = false;
private static synchronized runOnce() {
    if ( !hasRun ) {
       hasRun=true;
        blah...blah...blah
    }
    return;
}
Gene

Frank Fock wrote:
> 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
>



More information about the SNMP4J mailing list