2009/5/1  <[email protected]>:
> I want to call a function after snmpd sends cold-start after startup.

That's done in the file "snmpd.c" - in the routine main().
Look for the call to
     send_easy_trap(0. 0);
(probably around line 950, or 1020 depending on version)


> For this i dont want to put any code change in netsnmp standard files.
> I want to use a handler that will be called just after the sending of
> cold-start trap.

There isn't any such hook currently - you probably *would* have to
add code to the standard files to implement this.

Probably the simplest would be to define a new agent callback
(see includes/net-snmp/agent/agent_callbacks.h)
and invoke this immediately after the send_easy_trap(0, 0) call.

The init routine of your module could then register a callback,
using snmp_register_callback() - see init_agent_sysORTable
for an example.



If you really don't want to touch the standard code, then you
could try registering a callback function for one (or both)
of the two SEND_TRAP callbacks.   This would be invoked
whenever the agent sent *any* trap.
  Your routine could then check whether this was the initial
coldStart trap, and take appropriate action.   But that's a
fairly ugly solution, IMO.   A new callback would be much cleaner.

Dave

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to