[SNMP4J] SNMP4J Problem when updating an item in a table

Frank Fock fock at agentpp.com
Fri Apr 28 20:48:20 CEST 2006


Hello Anthony,

The SNMP4J-Agent code is OK, also the generated code.
What needs to be changed is the VACM configuration.
Access to the managed object is checked in the

query.matchesQuery(mo)

method of the VACMQuery executed. If you get a
noSuchName with SNMPv1 then this could mean (beside
others) that your object is not in the view for
the used community.

By using SNMPv2c or SNMPv3 you generally get a more
precise error message or VB exception code.

Hope this helps.

Best regards,
Frank

Zinger, Anthony J wrote:
> Hello,
> 
>   I have SNMP4J version 1.7 installed on a Windows PC running Microsoft
> Windows XP Version 2002 Service Pack 2.
> 
>  
> 
>   I am using Agent++ MIB Explorer Pro to update an item in MIB table
> that I have designed.  When I try to modify an item in my table, I keep
> getting the error "No such name".
> 
>  
> 
>   The agent messages that are displayed are:
> 
> 15524 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.4.1.x.1.2.1-1.3.6.1.4.1.x.1.2.2 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> 15524 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.4.1.x.2.1.0-1.3.6.1.4.1.x.2.1.0 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> 15524 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.4.1.x.2.2.1-1.3.6.1.4.1.x.2.2.2 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> 15584 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.6.3.15.1.1.6.0-1.3.6.1.6.3.15.1.1.6.0 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> 15584 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.6.3.15.1.2.1.0-1.3.6.1.6.3.15.1.2.1.0 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> 15584 [DefaultUDPTransportMapping_127.0.0.0/161] DEBUG
> org.snmp4j.agent.DefaultMOServer  - Scanning managed object:
> 1.3.6.1.6.3.15.1.2.2.1-1.3.6.1.6.3.15.1.2.2.2 for
> org.snmp4j.agent.CommandProcessor$VACMQuery[viewName=administratorsWrite
> View]=1.3.6.1.4.1.x.1.2.1.3.11<= x <=1.3.6.1.4.1.x.1.2.1.3.11
> 
> java.lang.Exception: Error 'No such name' generated at:
> 
>       at
> org.snmp4j.agent.request.SnmpRequest$SnmpSubRequest.requestStatusChanged
> (SnmpRequest.java:630)
> 
>       at
> org.snmp4j.agent.request.RequestStatus.fireRequestStatusChanged(RequestS
> tatus.java:79)
> 
>       at
> org.snmp4j.agent.request.RequestStatus.setErrorStatus(RequestStatus.java
> :50)
> 
>       at
> org.snmp4j.agent.CommandProcessor$SetHandler.prepare(CommandProcessor.ja
> va:573)
> 
>       at
> org.snmp4j.agent.CommandProcessor$SetHandler.processPdu(CommandProcessor
> .java:610)
> 
>       at
> org.snmp4j.agent.CommandProcessor.processRequest(CommandProcessor.java:3
> 00)
> 
>       at
> org.snmp4j.agent.CommandProcessor.dispatchCommand(CommandProcessor.java:
> 272)
> 
>       at
> org.snmp4j.agent.CommandProcessor$Command.run(CommandProcessor.java:407)
> 
>       at
> org.snmp4j.agent.CommandProcessor.processPdu(CommandProcessor.java:119)
> 
>       at
> org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.ja
> va:559)
> 
>       at
> org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.j
> ava:264)
> 
>       at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.ja
> va:325)
> 
>       at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.ja
> va:286)
> 
>       at
> org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(Abstrac
> tTransportMapping.java:83)
> 
>       at
> org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(Default
> UdpTransportMapping.java:284)
> 
>  
> 
>   After doing some further investigation, I found the following lines in
> lookup() method in DefaultMOServer.java, that I is causing my problem:
> 
>  
> 
>         MOScope moScope = mo.getScope();
> 
>         if ((query.getScope().isOverlapping(moScope)) &&
> 
>             (query.matchesQuery(mo))) {
> 
>           fireLookupEvent(mo, query);
> 
>           return mo;
> 
>         }
> 
>  
> 
>   If I change the line:
> 
> if ((query.getScope().isOverlapping(moScope)) &&
> 
> (query.matchesQuery(mo))) {
> 
>  
> 
>   To be:
> 
>       if ((query.getScope().isOverlapping(moScope)) ||
> 
>              (query.matchesQuery(mo))) {
> 
>  
> 
>   Then I can successfully modified items in my table.
> 
>  
> 
>   My question is this an error or am I not registering my Managed
> Objects correctly or defining my access views correctly.  I generated
> the code for my agent by using the Agent++ AgenPro2 to compile my MIB.
> Therefore, it generates all of the Managed Objects to register.  Also,
> for my access views, I have created a read and write access.  Both of
> these access views allow all of my MIB to be read or written.
> 
>  
> 
>   Thanks in advance for your help and answers. 
> 
>  
> 
>   A sample of my mib is the following:
> 
>  
> 
> a OBJECT IDENTIFIER 
> 
>       ::= { x 1 }
> 
>  
> 
> count OBJECT-TYPE
> 
>       SYNTAX  INTEGER (0..65535)
> 
>       MAX-ACCESS read-only
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       DEFVAL { 0 }
> 
>       ::= { a 1 }
> 
>  
> 
> aTable OBJECT-TYPE
> 
>       SYNTAX  SEQUENCE OF AEntry
> 
>       MAX-ACCESS not-accessible
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       ::= { a 2 }
> 
>  
> 
> aEntry OBJECT-TYPE
> 
>       SYNTAX  AEntry
> 
>       MAX-ACCESS not-accessible
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       INDEX { aIndex }
> 
>       ::= { aTable 1 }
> 
>  
> 
> AEntry ::= SEQUENCE {
> 
>     aIndex     INTEGER,
> 
>     aRowStatus RowStatus,
> 
>     aName      OCTET STRING }
> 
>  
> 
> aIndex OBJECT-TYPE
> 
>       SYNTAX  INTEGER (0..65535)
> 
>       MAX-ACCESS read-create
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       ::= { aEntry 1 }
> 
>  
> 
> aRowStatus OBJECT-TYPE
> 
>       SYNTAX  RowStatus
> 
>       MAX-ACCESS read-create
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       ::= { aEntry 2 }
> 
>       
> 
> aName OBJECT-TYPE
> 
>       SYNTAX  OCTET STRING (SIZE (1..64))
> 
>       MAX-ACCESS read-create
> 
>       STATUS current
> 
>       DESCRIPTION ""
> 
>       ::= { aEntry 3 }
> 
>  
> 
> Anthony J. Zinger
> 
> _______________________________________________
> 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