RE: fetch/poll asynchronously variables
Deybach Florent <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Date: Thu, 10 May 2007 10:02:50 +0100> From: [email protected]> To: [email protected]> Subject: Re: fetch/poll asynchronously variables> CC: [email protected]> > 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). Ok and what if the update is not ignited by the agent ? i.e. The agent cannot fetch itself the values in another application but the agent "register" on a server and the server send periodically (but when never know when, so we have to listen) the values in order to update them in the MIB. > > 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 Thx, Florent _________________________________________________________________ Essayez Live.com, votre nouvelle page d'accueil ! Personnalisez-la en quelques clics pour retrouver tout ce qui vous intéresse au même endroit. http://www.live.com/getstarted ------------------------------------------------------------------------- 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 [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users