Hi Frank,
thanks for the quick feedback. I must have not been really clear in my explanation and I apologize for that. What I want to achieve is not to add new rows into the table definition, but add new entries (new rows using addRowValue command) into the table. In other words, how do I add row values (addRowValue) to builder after having executed server.registerManagedObject(builder.build()); ? When I try to add row values using builder.addRowValue and then register the MO again, I get exception (quite expected, it is registered already) Thanks again Marek > Hi, > > The answer is very simple: Just add rows to the table (i.e. its table > model). > You can do this while the table itself is registered (operation is > thread safe). > > Best regards, > Frank > Subject: Updating registered managed objects (adding rows to MIB table) Dear all, I am writing a small SNMP related project for my course. The task is to create an SNMP agent that will monitor a local selected folder and list all files stored in this folder in a MIB. I have already MIB designed, agent working fine on the initial pass, i.e., it creates a MIB table, populates initial values (files found at first pass through the folder) and then registers MIB with the agent. The code snippet building the table structure is shown below: MOTableBuilder builder = new MOTableBuilder(oidNewRoot); // MIB structure builder.addColumnType(SMIConstants.SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ _ONLY); builder.addColumnType(SMIConstants.SYNTAX_OCTET_STRING,MOAccessImpl.ACCESS_R EAD_ONLY); builder.addColumnType(SMIConstants.SYNTAX_INTEGER,MOAccessImpl.ACCESS_READ_O NLY); builder.addColumnType(SMIConstants.SYNTAX_OCTET_STRING,MOAccessImpl.ACCESS_R EAD_ONLY); builder.addColumnType(SMIConstants.SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ _ONLY); builder.addColumnType(SMIConstants.SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ _ONLY); builder.addColumnType(SMIConstants.SYNTAX_OCTET_STRING,MOAccessImpl.ACCESS_R EAD_ONLY); builder.addColumnType(SMIConstants.SYNTAX_OCTET_STRING,MOAccessImpl.ACCESS_R EAD_ONLY); builder.addColumnType(SMIConstants.SYNTAX_INTEGER32,MOAccessImpl.ACCESS_READ _ONLY); builder.addColumnType(SMIConstants.SYNTAX_INTEGER,MOAccessImpl.ACCESS_READ_W RITE); The code snippet adding a row is shown below (it is repeated in a loop to add all found files): builder.addRowValue(new Integer32(index)); index++; builder.addRowValue(new OctetString(fileName.getName())); builder.addRowValue(new Integer32(3)); builder.addRowValue(new OctetString(fileName.getPath())); builder.addRowValue(new Integer32((int)fileName.length())); builder.addRowValue(new Integer32(323)); builder.addRowValue(new OctetString("Artista")); builder.addRowValue(new OctetString("Album")); builder.addRowValue(new Integer32(1980)); builder.addRowValue(new Integer32(4)); Finally, I register the new MIB with the agent: server.registerManagedObject(builder.build()); After that, I run agent on a loop, every 5 seconds checking whether a new file was added to the folder. When that happens, I can detect a new file added and create list of such files. However, I do not know (could not find any information) on how to add row to already registered MIB. One thought was on reusing previously constructed table and just deregister it, then add new rows as needed and the register again but it seems like a very crude solution to me. Is there any way to do that better? if so, I would appreciate any pointers. Thank you in advance Marek _______________________________________________ SNMP4J mailing list SNMP4J@agentpp.org http://lists.agentpp.org/mailman/listinfo/snmp4j