[AGENT++] RE: newbie MibTable question

Hong Chen hchen at portrait.com
Fri May 7 22:54:31 CEST 2004


It looks like MibTable::add_row() shall create all the MibLeaf objects from
the columnar objects defined for MibTable, so I use MibTableRow::get_nth()
and MibLeaf::replace_value and it works perfectly

thanks
hong

-----Original Message-----
From: Hong Chen
Sent: Thursday, May 06, 2004 6:58 PM
To: agentpp at agentpp.org
Subject: newbie MibTable question


hi folks,

This is a newbie question about MibTable.

I have a table defined as this :

devEntry {
	devIndex,  -- index
	devName, -- read-only
	...
	devLock -- read-write
}

All the device information can be retrieved from a system config file.
'devLock' is the only object that could be set ( otherwise it should be
fairly easy to use 'MibStaticTable' and 'MibStaticLeaf')

What I want to do is to create an instance for each device from the system
config file when snmp agent is started up. Once the agent is up, I may do a
snmpset against devLock object.

To implement this, I define the classes
class devEntry : public MibTable {
...
};

class devName : public MibLeaf {
...
};

class devLock : public MibLeaf {
...
};

To add the instances to the devTable,

devEntry* pDevEntry = new devEntry(...);

MibTableRow pRow = pDevEntry->add_row(...);
pRow->add(new devName(...)...);
pRow->add(new devLock(...)...);
...
mib.add(pDevEntry);
...

I guess this is not quite right as I don't see the devName, devLock objects
added when the agent is started up, and a snmpwalk don't find the objects.

Should I use other method to add these pre-loaded data, like
MibTable::add_col() ?

thanks in advance
hong




More information about the AGENTPP mailing list