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

Jean.Bauwin at sita.aero Jean.Bauwin at sita.aero
Mon May 11 14:13:02 CEST 2009


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


More information about the SNMP4J mailing list