------------------ Original ------------------

From:  "Dave Shield";

Date:  Sat, Jan 23, 2010 05:04 PM

To:  "Alexander King"; 

Cc:  "net-snmp-users"<NET-SNMP-USERS@LISTS.SOURCEFORGE.NET>; 

Subject:  Re: when snmpwalk query my private trap OID the snmpd routine auto 
termination

On 23 January 2010 05:33, Alexander King wrote:

> But I do not know how to implement the trap in the MIB file

"Implementing a trap" means writing code to construct and send the trap,

and invoking this at the appropriate time.

This is handled (at least in part) by the mib2c template  "mib2c.notify.conf"

>>>>I use mib2c -c mib2c.notify.conf,is it right?

> the trap is a part of the MIB file,and traps have their own OIDs

Correct.

> and related some specific OBJECT-TYPE value(s),

Typically, yes.

Those related OBJECT-TYPE values are often accessible to GET*

requests, as well as being included in the payload of the relevant traps.

But these payload OIDs are different from the OID of the trap itself.

Don't get the two confused.

>>>>In my prototype,one trap mapping a OBJECT-TYPE(they are all RO type and 
>>>>assigne value in the source code before complie it into the master agent. )

> how to define the trap  can make the walk routine donot walk it?

If the agent does not include code to handle incoming requests

for a particular OID, then walking the agent will ignore that OID.

In particular, if you don't register a given OID, then the walk will

ignore it.
 
>>>>Delete the trap OID?is it simply delete it ? if so,how the routine generate 
>>>> a trap?I just want to send traps,donot want to walk by the snmpwalk 
>>>>routine,maybe it is why make the snmpd auto termination.
 

The code generated by mib2c.notify.conf does not include any

registration of the OID.  Contrast this with the code generated by

the other (OBJECT-TYPE) mib2c templates.
 
>>>>I notice this.in the file generated by mib2c.notify.conf tool does not 
>>>>include OIDs like the other files generated by other tools.

> All I need is some prototype for my reference,so I can imitate,

> modify,implement in my project.(I know it is hard to find one,they are all 
> difference.)

Why not start with the code in 'agent/mibgroup/examples/notification.c' ?

That's probably as simple a setup as you're likely to find.

>>>>Yes, I got it,but I found something unusual

in notification.c:
void
send_example_notification(unsigned int clientreg, void *clientarg)
{…………}

my uit.c( generated by mib2.notify.conf tool):
 
int
send_XXX_trap( void )
{ …………}
 
is there something unusual or diffenence? in my initialization function 
init_uit() I call snmp_alarm_register() function each time for every trap like 
below:
 
snmp_alarm_register(10,     /* seconds */
                    SA_REPEAT,      /* repeat (every 10 seconds). */
                    send_systemJBODNumbertrap_trap,      /* our callback */
                    NULL    /* no callback data needed */
                    );
 
Is there something I wrong?
 
Pls trust me I tried to mail  small pieces of code .
 
 
 
Alex
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
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

Reply via email to