[SNMP4J] Concurrent requests for multiple agents.
Lilach Refaeli
lilachr at allot.com
Wed May 18 13:56:50 CEST 2005
Thanks Frank,
I changed the code to work with a single addition of USM user, but I'm
still getting the Not-In-Time-Windows OID from time to time.
The code of adding the user is:
private synchronized void addUsmUser(
Snmp snmp,
String securityName,
OID authProtocol,
String authPassphrase,
OID privacyProtocol,
String privacyPassphrase
) {
USM usm = snmp.getUSM();
// If not exists, Add the user model to the security
model.
if (usm==null) {
byte[] localEngineID =
MPv3.createLocalEngineID();
usm = new USM(
SecurityProtocols.getInstance(),
new OctetString(localEngineID),0);
SecurityModels.getInstance().addSecurityModel(usm);
}
OctetString securityOctString = null ;
OctetString authPassphraseOctString = null;
OctetString privacyPassphraseOctString = null;
if(securityName != null){
securityOctString = new OctetString
(securityName);
}
if(authPassphrase != null){
authPassphraseOctString = new
OctetString(authPassphrase);
}
if(privacyPassphrase != null){
privacyPassphraseOctString = new
OctetString(privacyPassphrase);
}
// Add USM user to the security model
if (usm.getUserTable().getUser(securityOctString)==null)
{
// Add user to the user list of the SNMP object
UsmUser usmUser = new UsmUser(
securityOctString,
authProtocol,
authPassphraseOctString,
privacyProtocol,
privacyPassphraseOctString);
snmp.getUSM().addUser(securityOctString,usmUser);
}
}
Do you have any idea what might be the reason?
Thanks a lot,
Lilach
-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com]
Sent: Wednesday, May 18, 2005 10:25 AM
To: Lilach Refaeli
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Concurrent requests for multiple agents.
Hi Lilach,
Lilach Refaeli wrote:
>I have a multi-threaded Application, which sends requests to different
>agents concurrently (synchronously).
>
>It uses one instance of the SNMP object.
>
>The USM user parameters (authentication passphrase, authentication
>protocol ID, etc.) of all the agents are identical.
>
>My question is:
>
>Should I add a USM user for each agent? How would the SNMP object know
>
>
No, since all your your user and password pairs are identical, you only
add the user once. Otherwise, if you add it (non localized - thus
without engine ID)
at a later time other requests running concurrently will see timeouts
out of time
window errors.
>which USM user to use for the sending operation? (When is the agent-ID
>discovery process activated?)
>
>
>
The engine ID of a target is discovered when a request is sent to it and
there is
no engine ID known for that target.
>Is there a way to explicitly perform the agent ID discovery? (To add a
>user and associate it with a specific engine ID)
>
>
>
Yes, you can disable engine ID discovery at the USM class and use
MPv3.getEngineID(Address addr) to discover the engine ID.
>
>
>When I add a USM user with no agent ID parameter and send requests
>concurrently, I get an usmStatsNotInTimeWindows response or a timeout
>occurs.
>
>
>
>
This can be caused by updating the user while requests are currently
processed
(or if some of the targets share the same engine ID - but that should
not be the case).
Best regards,
Frank
More information about the SNMP4J
mailing list