Re: When I want to send trap the routine cannot run

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 27 July 2010 09:58, Alexander King <[email protected]> wrote:
> In my project ,I want to call sendtempJBODTempTrap() in init_uit()

No - I don't think you can send traps quite so early as that.

Remember that the individual module init_xxx routines are
called *before* the config files are read in (since this is where
per-module config directives are registered).
  The trap destinations are typically set up via the config files,
so you can't start sending traps until after this is finished.

Instead there's a callback chain which is invoked after the
config files have been processed.   Try registering a routine
using
         snmp_register_callback(SNMP_CALLBACK_LIBRARY,
                           SNMP_CALLBACK_POST_READ_CONFIG,
                          sent_temp_trap_callback, NULL);

and move the code to send the trap into this callback routine.
See (e.g.) mibII/vacm_conf.c  for an example of this callback in use.

Dave

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.