Hi Frank,
Thank you for the quick answer.
I removed the "dots" from the OID numbers, but the problem still remains. I
did not find any standard MIBs that have OID 1.3.6.1.3.22.1 so I am not
quite sure why there would be a clash here. This is the first time I
register the OIDs in my agent and there are no other agents running on my
machine that could use this particular OID value.
Also, I'd very much appreciate if you could point me to any code that
provides the definition of my own OID root. I could not find that in the
sample agent code.
Thank you in advance
Marek
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Frank Fock
Sent: Saturday, 30 March, 2013 2:37 PM
To: [email protected]
Subject: Re: [SNMP4J] Registering multiple managed objects and
org.snmp4j.agent.DuplicateRegistrationException error
Hi,
First, OIDs start with a number, not a dot.
Second, you need to register your own OID root. You must not define any OIDs
in subtrees of other vendors or standard MIB modules.
In your case, your OIDs clash with other OIDs in the agent -> that's why a
DuplicateRegistrationException is being thrown.
Best regards,
Frank
Am 30.03.2013 14:35, schrieb Marek Hajduczenia:
Dear colleagues,
I am continuing the development of my project and now I have a rather
simple task that keeps on generating errors for some reason I do not
quite understand. But let me first describe what I am doing and what
the output
is:
[1] I create 4 individual OID to be used later on
OID oidLocalHostName = new OID(".1.3.6.1.3.22.1.1"); // nomeServidor
OID oidRootFolder = new OID(".1.3.6.1.3.22.1.2"); // diretoriaBase
OID oidDefaultPlayer = new OID(".1.3.6.1.3.22.1.3"); // musicPlayer
OID oidNumberOfMusicFiles = new OID(".1.3.6.1.3.22.1.4"); //
nTotalmMsicasDisp
[2] then I try to register individual new managed objects as follows
server.registerManagedObject(MOCreator.createReadOnly(oidLocalHostName
, java.net.InetAddress.getLocalHost().getHostName()));
server.registerManagedObject(MOCreator.createReadOnly(oidDefaultPlayer
, "VLC")); // HERE IS THE LINE WITH ERROR
server.registerManagedObject(MOCreator.createReadOnly(oidRootFolder,
folder.getAbsolutePath()));
server.registerManagedObject(MOCreator.createReadOnly(oidNumberOfMusic
Files,
0));
the function registerManagedObject is just a simple wrapper defined as
follows:
public void registerManagedObject(ManagedObject mo)
{
try
{
server.register(mo, null);
}
catch (DuplicateRegistrationException ex)
{
throw new RuntimeException(ex);
}
}
I get however the following error on console:
208 [main] INFO org.snmp4j.agent.DefaultMOServer - Registered MO
org.snmp4j.agent.mo.MOScalar[oid=1.3.6.1.3.22.1.1,access=org.snmp4j.ag
ent.mo .MOAccessImpl@3ce3e8f3,value=Marek-HP,volatile=false] in
default context with scope
org.snmp4j.agent.mo.MOScalar[oid=1.3.6.1.3.22.1.1,access=org.snmp4j.ag
ent.mo .MOAccessImpl@3ce3e8f3,value=Marek-HP,volatile=false]
Exception in thread "main" java.lang.RuntimeException:
org.snmp4j.agent.DuplicateRegistrationException:
org.snmp4j.agent.DefaultMOContextScope[context=null,lowerBound=1.3.6.1.3.22.
1,lowerIncluded=true,upperBound=1.3.6.1.3.22.2,upperIncluded=false]
at
org.snmpagent.snmpAgentServer.registerManagedObject(snmpAgentServer.ja
va:177
)
at
org.snmpagent.snmpAgentClientMain.main(snmpAgentClientMain.java:160)
Caused by: org.snmp4j.agent.DuplicateRegistrationException:
org.snmp4j.agent.DefaultMOContextScope[context=null,lowerBound=1.3.6.1.3.22.
1,lowerIncluded=true,upperBound=1.3.6.1.3.22.2,upperIncluded=false]
at
org.snmp4j.agent.DefaultMOServer.register(DefaultMOServer.java:279)
at
org.snmpagent.snmpAgentServer.registerManagedObject(snmpAgentServer.ja
va:173
)
... 1 more
With the information that the content was registered at OID of
1.3.6.1.3.22.1.1 (oidLocalHostName) with the default context (null).
The attempt to perform registration for OID of 1.3.6.1.3.22.2 causes
the org.snmp4j.agent.DuplicateRegistrationException for some reason. I
looked through the documentation associated with this error, but
cannot still locate what the problem is. Any hints?
Also, is there a better / cleaner way to create a number of OIDs with
specific values? I looked through the examples in the SampleAgent
class, but there is no clear example of how that could be done.
Thanks for any help
Marek
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j