Re: Sending trap from source code

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 24/03/2008, Pranesh Kulkarni <[email protected]> wrote:
>   If I want to recompile my mib pranesh-MIB,  what the <pranesh-MIB>.h
> contents should be ??

Whatever "mib2c -c mib2c.notify.conf" generated.
You take the two files generated by this command,
tweak them to match your requirements (if necessary),
and copy them into 'agent/mibgroup'

  Let's say they are called 'praneshTrap.c' and 'praneshTrap.h'
Then run "configure --with-mib-modules=praneshTrap"
and recompile the agent.


>  I recompiled the snmpd with --with-mib-modules="examples/notification" ..
> How to send the traps from the agent now ??

*How* to send traps?
   Simply call the routine 'send_pranesh_trap()'
(or whatever it's actually called - see the .h file for the actual name)

The more interesting (i.e. difficult) question is *when* to send the trap.
What is this trap meant to report?   When would you like it to be sent?



>   I went through some sample .h files , It contains config_require lines.
> Can some one explain me about this

"config_require" is an instruction to the "configure" script, and is used
to group collections of MIB modules together.   The main use is to
allow something like

     --with-mib-modules=host

to pull in the modules 'host/hr_system', 'host/hr_device',
'host/hr_printer' etc.
Rather than you having to list all these explicitly in the '--with-mib-modules'
line.

   It's also used when one MIB module relies on another.
For example, the latest 'host/hr_proc' module relies on the (new)
'hardware/cpu' module to do most of the low-level work.   It simply
can't run without this hardware-specific CPU module.
   So there is a line
        "config_require(hardware/cpu)"
                in the hr_proc.h file, to make sure that the hardware
CPU module is included.


In your situation (as you've described it so far), that's probably not
relevant.   You should be able to manage with the .h file as generated
by mib2c.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
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.