[SNMP4J] Unsupported security model

Kazantsev, Andrey V. kazantsev at axmor.com
Wed Jun 23 11:30:53 CEST 2010


I'm glad to hear that I helped you.

What user name do you mean? In fact there is only security name, which is first argument to UsmUser constructor. You use it later for adding this user to USM instance (usm.addUser(user.getSecurityName(), user)). I just called security name with "username", but it could be arbitrary string.

-----Original Message-----
From: Gian Marco Gallo [mailto:gianmarco.gallo at elaide.com] 
Sent: Wednesday, June 23, 2010 16:12
To: Kazantsev, Andrey V.
Subject: Re: [SNMP4J] Unsupported security model

  Hello

Thanks for your quick reply. I've tried your code and after five tries 
it now works. In fact I didn't understand that the username and the 
security name have to be equals (confirm?). But now it works fine.

Thanks again for your help
Have a nice day


Il 23/06/2010 04:28, Kazantsev, Andrey V. ha scritto:
> Hello.
>
> I think you should create USM (User Security Model) and add it to your SNMP session. Consider following example:
>
> USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
> SecurityModels.getInstance().addSecurityModel(usm);
>
> Also you maybe want to add user (noAuthNoPriv):
> user = new UsmUser(new OctetString("username"), null, null, null, null);
> usm.addUser(user.getSecurityName(), user);
>
> This example code from http://www.snmp4j.org/doc/org/snmp4j/Snmp.html
>
> Also you can look at SnmpRequest.java from snmp4j-1.11.zip\snmp4j-1.11\src\org\snmp4j\tools\console\
>
> -----Original Message-----
> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Gian Marco Gallo
> Sent: Tuesday, June 22, 2010 21:41
> To: snmp4j at agentpp.org
> Subject: [SNMP4J] Unsupported security model
>
>    Good afternoon
>
> I am trying to send a trap message to a server listening for snmp messages but when I try to send the trap an exception is throwed:
> 16:20:12,817 ERROR [STDERR] org.snmp4j.MessageException: Message processing model 3 returned error: Unsupported security model
> 16:20:12,817 ERROR [STDERR]     at
> org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:465)
> 16:20:12,818 ERROR [STDERR]     at
> org.snmp4j.Snmp.sendMessage(Snmp.java:1067)
> 16:20:12,818 ERROR [STDERR]     at org.snmp4j.Snmp.send(Snmp.java:882)
> 16:20:12,818 ERROR [STDERR]     at org.snmp4j.Snmp.send(Snmp.java:875)
> 16:20:12,818 ERROR [STDERR]     at org.snmp4j.Snmp.send(Snmp.java:840)
> 16:20:12,818 ERROR [STDERR]     at
> com.elaide.crypto.ext.web.snmp.TrapSnmp.sendTrap(TrapSnmp.java:94)
> 16:20:12,818 ERROR [STDERR]     at
> com.elaide.crypto.ext.web.snmp.TrapSnmp.createAndSend(TrapSnmp.java:42)
> 16:20:12,818 ERROR [STDERR]     at
> com.elaide.crypto.ext.web.listeners.IndexListener.loadUserManager(IndexListener.java:47)
> 16:20:12,818 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:20:12,818 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:20:12,818 ERROR [STDERR]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:20:12,818 ERROR [STDERR]     at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:20:12,818 ERROR [STDERR]     at bsh.Reflect.invokeMethod(Unknown Source)
> 16:20:12,818 ERROR [STDERR]     at
> bsh.Reflect.invokeObjectMethod(Unknown Source)
> 16:20:12,818 ERROR [STDERR]     at bsh.Name.invokeMethod(Unknown Source)
> 16:20:12,818 ERROR [STDERR]     at bsh.BSHMethodInvocation.eval(Unknown
> Source)
> 16:20:12,818 ERROR [STDERR]     at bsh.BSHPrimaryExpression.eval(Unknown
> Source)
> 16:20:12,819 ERROR [STDERR]     at bsh.BSHPrimaryExpression.eval(Unknown
> Source)
> 16:20:12,819 ERROR [STDERR]     at bsh.Interpreter.eval(Unknown Source)
> 16:20:12,819 ERROR [STDERR]     at bsh.Interpreter.eval(Unknown Source)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:134)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:341)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:840)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:175)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:140)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:517)
> 16:20:12,819 ERROR [STDERR]     at
> org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:444)
>
> I've searched for two days a solution in the snmp4j documentation and over internet but no luck. Do you have an idea?
> I'm attaching my simple snmp class.
>
> Thanks in advance
>
> --
> Gian Marco Gallo
> Elaide SRL
>
> Email: gianmarco.gallo at elaide.com
> Phone: +39 049 4102390
>
>
>


-- 
Gian Marco Gallo
Elaide SRL

Email: gianmarco.gallo at elaide.com
Phone: +39 049 4102390




More information about the SNMP4J mailing list