[AGENT++] Hmmm, another try with the table questions?

Frank Fock fock at agentpp.com
Fri Jun 18 09:17:45 CEST 2004


Mr. AWD wrote:

> 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.
>
>  
>
The number of interfaces does not vary often, so it might be a reasonable
approach to create the rows when the agent is initialized and update
(add/remove) the number of rows by overwriting the MibTable::update method.

>
>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...
>
>  
>
Of course, your code will have to create them. AGENT++ does not know how 
many
rows you need and with which indexes.

>
>  
>
>
>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.
>
>  
>
If you use the update method to update your table, then you can use the 
AgenPro
lightTables option with "yes". Otherwise, if each MibLeaf in the table 
updates itself,
then you should set lightTables to "no".

>
>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)?
>
>
>  
>
See above.

>  
>
>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?
>
>  
>
The MibTable::update method is called automatically by the AGENT++ framework
whenever a table needs to accessed. It is not called more often than 
needed!

Best regards,
Frank





More information about the AGENTPP mailing list