[SNMP4J] Adding data to Table with multiple indices in SNMP4J-Agent

Frank Fock fock at agentpp.com
Thu Jul 19 19:19:10 CEST 2007


Hi,

You do not quoted the column/index OBJECT TYPE
definitions. Is your index not-accessible or
read-only?
I seems that you think it is read-only, but
that's not allowed in this case (by SMIv2).

For multi object indexes, you specify the
values of each object mapped to index notation
concatenated as the index OID.

In your case, the code should read:

Variable[] rowValues1 = new Variable[] {
               new OctetString("good"),
              new Integer32(1)
}

rsOutputsEntryModel.addRow(new DefaultMOMutableRow2PC(new OID("2.34"), 
rowValues1));

Best regards,
Frank


minreddy minreddy wrote:
> I have a  table with two indices as shown below
> 
> ------------------------------------------------------------
> RS-MIB 
> 
> rSys  OBJECT IDENTIFIER ::= { enterprises 31420 }
> 
> rsTable  OBJECT-TYPE
> 
> 
>         SYNTAX SEQUENCE OF RsOutputsEntry
>         MAX-ACCESS not-accessible
>         STATUS     current
>         DESCRIPTION 
>                 ""
>         ::= { rSys 1 }
> 
> rsOutputsEntry  OBJECT-TYPE
>         SYNTAX  RsOutputsEntry
>         MAX-ACCESS not-accessible
>         STATUS     current
>         DESCRIPTION 
>                 ""
>         INDEX { rsLevelID, 
>                 rsOutputID }
>         ::= { rsTable 1 }
> 
> RsOutputsEntry ::= SEQUENCE {
>         rsLevelID Integer32, -- rsOutputsEntry 1
>         rsOutputID Integer32,  -- rsOutputsEntry 2
>         rsOutputsName DisplayString,  -- rsOutputsEntry 3
>         rsOutputState TruthValue  -- rsOutputsEntry 4
> }
> 
> 
> -------------------------------------------------------------------------------------------------------------
>  
> The code generated by agentpro for multiple indices are
> rsOutputsEntryIndexes = 
>       new MOTableSubIndex[] {
>       moFactory.createSubIndex(oidRsLevelID, 
>                                SMIConstants.SYNTAX_INTEGER, 1, 1),
>       moFactory.createSubIndex(oidRsOutputID, 
>                                SMIConstants.SYNTAX_INTEGER, 1, 1)    };
>  
> 
> 
> 
> Now the question is how to add  row.
> 
> I have created a row like as shown below
>  Variable[] rowValues1 = new Variable[] {
>             new Integer32(2),
>             new Integer32(34),
>              new OctetString("good"),
>             new Integer32(1)
> }
> 
> rsOutputsEntryModel.addRow(new DefaultMOMutableRow2PC(new OID("1"), rowValues1))
> 
> 
> When i try to get rsOutputsName 
>  
> %snmpget   rSys.rsTable.rsOutputsEntry.rsOutputsName.2.3
> 
>  No Such Instance currently exists at this OID  
> 
> 
> Any help will be appreciated.
> 
> rgds
> Minred
> 
>        
> ---------------------------------
> Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 
> _______________________________________________
> 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