On Tue, 6 Jul 2004 13:57:12 +0200 Arne wrote:
AB> RS> How are you going to get the data to the agent? Shared memory?
AB> RS> database? How big is the array?
AB> 
AB> At the moment, I use a global variable protected by a pthread_mutex.


AB> RS> [...] I'm thinking is adding a cache handler to an array-user table.
AB> RS> The cache handler will take care of getting an up to date container.
AB> 
AB> Is there any example code or hints about the structure and
AB> implementaion of such a cache container?

If you are looking at 5.1.x, I believe the tcp table uses a cache. It's really
quite simple. Create a cache handler and inject it into your handler chain.
If you want your data kept fresh, set the timeout low. Save the container for
the array user table as the my void pointer. In your cache_load routine,
insert rows into the container. In the cache_unload routine, free everything
from the container.

The other option would be to use the array-user container as the storage, and
have the thread add/delete to the container directly. The only gotcha there
would be that the agent thread would need the thread lock for the duration of
the snmp request processing. If that is too long, then the data thread might
need to be tweaked to have a temporary store for statistics collected while
waiting for the lock.

-- 
Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
<irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to