[SNMP4J] How to update a MO on a table or a scalar MO.

Frank Fock fock at agentpp.com
Tue May 12 20:10:55 CEST 2009


Hello Jean,

1) Get the row you want to update with:
    MOMutableTableRow r = (MOMutableTableRow )
       rowMOTable.getModel().getRow(rowIndex);
    r.setValue(columnIndex, newValue);
2) scalar.setValue(newValue);

Best regards,
Frank

Jean.Bauwin at sita.aero wrote:
> Hello,
> 
> I use the testAgent.java class to customize an agent ofr my software.
> 
> The testAgent is ok , i send my customized trap , i have added this scalar 
> :
> 
>   //add general status
>       MOScalar myScalar = new MOScalar(new OID(
> "1.3.6.1.4.1.4976.10.1.1.20.1.1.0"),MOAccessImpl.ACCESS_READ_CREATE, new 
> OctetString("myText"));
>       server.register(myScalar, null);
> 
> and this table :
> 
> private static DefaultMOTable createStaticIfTable() {
>     MOTableSubIndex[] subIndexes = new MOTableSubIndex[] { new 
> MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) };
>     MOTableIndex indexDef = new MOTableIndex(subIndexes, false);
>     MOColumn[] columns = new MOColumn[5];
>     int c = 0;
>  
>     columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, 
> MOAccessImpl.ACCESS_READ_ONLY);// name-application
>     columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, 
> MOAccessImpl.ACCESS_READ_ONLY);// server
>     columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, 
> MOAccessImpl.ACCESS_READ_ONLY);// online
>     columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, 
> MOAccessImpl.ACCESS_READ_ONLY);// standby
>     columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, 
> MOAccessImpl.ACCESS_READ_ONLY);// table connection ????
> 
> 
>     ifTable = new DefaultMOTable(new OID("1.3.6.1.4.1.881.5.3.200.1.1.1"), 
> indexDef, columns);
>     MOMutableTableModel model = (MOMutableTableModel) ifTable.getModel();
>     rowValues1 = new Variable[] {
>         new OctetString("EVATIS"),
>         new OctetString("SERVER-1"),
>         new OctetString("ON"),
>         new OctetString("OFF"),
>         new OctetString("CONNECTIONS")
>     };
>  
>     model.addRow(new DefaultMOMutableRow2PC(new OID("1"), rowValues1));
>  
>     ifTable.setVolatile(true);
>     return ifTable;
>   }
> 
> But, i dont understand how i can update the MOtable and MOscalar.
> 
> 1/ For example, how to change the string EVATIS by "toto" to the row 1 of 
> my MOtable ?
> 2/ Another question, how to update the scalar "mytext" by "ploufplouf" ?
> 
> Thx for your future response !
> 
> Brgds,
> 
> Jean Bauwin
> Software Engineer
> SITA Air Traffic Solutions 
> Tel:  +33 1 46 41 10 80
> Fax: +33 1 46 41 10 32
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list