[AGENT++] Hmmm, another try with the table questions?
Mr. AWD
mrawd at excite.com
Thu Jun 17 18:15:32 CEST 2004
> The number of indexes for your table does not impose any additional complexity with AGENT++.
Well, the thing is that my agent has to support systems with different number of interfaces on each board (also a variable). One of the tables is there to show how many interfaces each of the board has. So, at the startup, I could figure out those numbers and if I have 5 interfaces on the first board and 3 on the second one, then I need a table with index of 2 to store the numbers in interfaces for each of the board. Respectively 5 and 3.
Since in this case I need two rows, who is going to create those? It looked to me that I need to do it, but...
> AGENT++ itself come with a couple of table implementations. For simple
> ones, you can take a look at the snmp_target_mib.cpp file. For complex
> ones, you can take a look at v3_mibs.cpp (the USM MIB implementation).
I looked at those and it seems that I need to create a new object for each element of the table derived from the MibLeaf objects so I can override get_request() and fill it with the correct values.
But, for the MibTable::get_request() to work correctly, rows have to be added or otherwise MibTable::find() will not find anything in there and return sNMP_SYNTAX_NOSUCHOBJECT. So, again problem is in who is going to add the correct number of rows (in my case as many as I have boards in the system)?
> You can set the whole row, but that's not needed. You have several options
> (this may be confusing I have to admit):
>
> 5. Within the MibLeaf::get_request method, use the AgenPro set_state
> method to set the value (recommended as 4 and easy to use)
This is usually the one that I use, so I am OK here!
> 6. Within the MibTable::get_request method, use set_row to set the whole
> row.
> This is not very efficient since you will have repeat that for each
> sub-request.
How can I recognize the difference between the main and the sub requests?
> 7. Within the MibTable::update(..) method, you can add/remove rows
> dynamically before a request is processed. Overwriting the
> MibTable::update method is recommended for large tables that do not fit
> efficiently into memory. Those tables are then implemented as virtual
> tables where only the needed rows are actually present at a time.
>
>
> A good place to add/remove rows is the MibTable::update method. Since
> this method could be called more than once per request by AGENT++, it is
> recommended to implement a sort of timeout to not update the table too
> often.
So, let say that I add a code in the MibTable::update method that figures out how many boards I have and those create appropriate number of rows. From where would you recommend calling this function, since it would need to be called only once?
Thanks!
Fedja
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
More information about the AGENTPP
mailing list