Mib table and DB table

Alex Finogenov afinogenov____malibunet.com
Mon Aug 20 18:39:46 CEST 2001


Ron,

Multi-threaded agent would add a bit of complexity. At this point I am not
worrying about this because I am not sure how much benefit would the MT
solution bring. If I had to move to an MT solution, I would have to
implement my own context switching of the table's state since tables in
Agent++ are singletons.

Initially I tried to work with recommended MibComplexEntry, but I came to
conclusion that I have to add much more code than if I simply Decorate the
MibTable.

Regarding GetBulk - if you implement GetNext, you get GetBulk for free. You
can implement GetNext in a number of ways, but extending
MibTable::find_succ() seems to be the simplest. The idea is that the agent++
calls find_succ() every time it needs to get the next object. My version of
find_succ() loads the next object into its respective row (if the object
exists), then calls MibTable::find_succ() to finish the job. You can
implement a number of optimizations here, depending on your system's
requirements and how stateful it is (caching of the accessed objects, etc.)
Don't forget to try to load the first object in a table if the "next" object
is not found, or you won't get the required behavior.

Alex

-----Original Message-----
From: Ron Sperber - Israel [mailto:RonS____gilat.com]
Sent: Sunday, August 19, 2001 10:43 AM
To: 'agentpp-dl____agentpp.com'
Subject: RE: Mib table and DB table


Thanks Alex,
I've tried your suggestion and it works fine with the following exceptions:
 - I don't get the same results when more than one manager queries the Mib
simultaneously -      
   My agent is multithreaded.
 - I have problems with GetBulk - can you give a pointer on how you
implemented it ?

Frank suggested using the MibComplexEntry class - I couldn't think on any
good sheme - Can any one help me with this one ?
TIA, 
	Ron

> -----Original Message-----
> From: Alex Finogenov [mailto:afinogenov____malibunet.com]
> Sent: Wednesday, August 08, 2001 8:13 PM
> To: 'Ron Sperber - Israel'; 'agentpp-dl____agentpp.com'
> Subject: RE: Mib table and DB table
> 
> 
> Ron,
> 
> I have been working on this for a few weeks. Depending on 
> your requirements
> and complexity of the MIB (tables with AUGMENTS clause, 
> etc.), it may be
> complex.
> 
> My major requirement was to modify minimum code when a MIB is changed
> (recompiled). I achieved this by subclassing  MibTable (use 
> Decorator and
> Bridge design patterns) and overloading update() (you preload all the
> relevant rows for the request), prepare_set_request() (here I added
> additional validation, fix agent++ bugs until the new release),
> commit_set_request() (here I figure out which rows have been added,
> modified). Also I overloaded row_added() and row_delete() 
> (the latter is the
> only way to easily know when a row is deleted.)
> 
> The main logic is was not a problem, returning right errors and make
> dependent tables (with AUGMENTS clause) work in cooperation 
> with their base
> tables is more challenging. There is also a problem of 
> rolling back and
> returning proper errors when something goes wrong in the back 
> end systems
> while everything passed fine through the SNMP agent.
> 
> You may have to write some sort of simple state machine to 
> keep track of
> what has happened and what has to happen to your tables, because the
> agent++'s processing of the varbinds depends only on the 
> sequence of them in
> the request, but table independencies may force you to have your own
> sequence of events (update(), prepare_set(), etc.)
> To deliver the agent in a short time frame I had to go 
> single-threaded.
> 
> Have fun,
> 
> Alex  
> 
> -----Original Message-----
> From: Ron Sperber - Israel [mailto:RonS____gilat.com]
> Sent: Wednesday, August 08, 2001 9:46 AM
> To: 'agentpp-dl____agentpp.com'
> Subject: Mib table and DB table
> 
> 
> Hi,
> I have this dilemma:
> I've constructed a mib containing a table that corresponds to 
> a dynamic
> table located in an SQL server.
> This table can contain up to 10,000 entries and is a dynamic 
> one - meaning
> row van be added or deleted.
> My question is - since I do not want to keep all the table 
> present in the
> memory all the time (which means that I have to pass all over 
> the DB table
> once a while) I need another schema to respond with the right values.
> I thought of 2 solutions
> 	- using the MibComplexEntry - but in this case there a lot of DB
> access per request (at least in my implementation...)
> 	- using the usual mibTable and update the Mib in the 
> update function
> - but in this case when do I delete the entries ? I 	  can 
> expect several
> managers querying simultaneously.
> Has anyone dealt with such situation?
> thanks in advance ,
> 			Ron
> 



More information about the AGENTPP mailing list