On 09/05/07, Deybach Florent <[EMAIL PROTECTED]> wrote: > In the agent I have to fetch asynchronously the value of the variables in my > MIB. i.e. I don't want to fetch it only when on a GET command. > I have to keep the variables all the time up-to-date. > So I must poll "in background" to update the variables in the MIB and > eventually send a trap. > > How Can I do this ? > With a thread which will update the MIB ?
You *could* use a separate thread if you were very very careful (bearing in mind that the Net-SNMP agent is not designed for threaded-operation). But the simplest approach would be to write a cache-based implementation (using the standard cache helper), and set the cache flag 'NETSNMP_CACHE_AUTO_RELOAD' That single change is sufficient to have the agent automatically reload the data on a regular basis (determined by the cache timeout value). > Are there any examples ? There are relatively few examples of this sort of cache auto-reloading, all MfD-style implementations (if-mib/ifTable, ip-mib/ipAddressTable and ip-mib/ipSystemStatsTable). There are more examples of cache-based MIB modules, and most of the mib2c config frameworks can generate a cached-based template. I'd suggest that you implement the MIB "normally", using whichever table framework you're most comfortable with, and using the cache helper to load data on demand. Then once this is working properly, set the 'NETSNMP_CACHE_AUTO_RELOAD' cache flag to get the required automatic behaviour. Dave ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users