David , thank you very much,

now i get the traps from my MIB,

last question about the

varbind list , can you give an example

how such a varbind list looks like ?

Is this the struct you mean:

struct variable_list {
   struct variable_list *next_variable;
   oid            *name;
   size_t          name_length;
   u_char          type;
   netsnmp_vardata val;
   size_t          val_len;
   oid             name_loc[MAX_OID_LEN];
   u_char          buf[40];
   void           *data;
   void            (*dataFreeHook)(void *);
   int             index;
};

Thanks you for your time

best regards

Stefan




Dave Shield wrote:

Sorry that I went on your nerve again:



No - you haven't annoyed me. The only reason I responded on the -coders list was that Robert's response was misleading in terms of the question that you'd asked. Since these messages are archived, I'm reluctant to let inaccurate replies go unchallenged, in case they mislead people in the future.

(Yes, I know - it's naive in the extreme to expect people
to read the documentation, let alone search mailing list
archives.   But I can dream....)




my question was how I can send a trap with all informations
like MIB, Trapname , OID etc.



OK - in that situation, Robert's response would be quite correct. The call "send_easy_trap" will trigger a notification, but doesn't allow ypu to specify a varbind list to accompany it.

To do that you need to use one of:

        send_v2trap
        send_trap_vars
or      send_enterprise_trap_vars

send_v2trap requires you to specify the trap as a varbind
        snmpTrapOID.0 = {yourTrap}
at the head of the varbind list - even if you actually want
to send an SNMP v1 trap.

The other two take v1-style (trap,specific) numbers as well
as the varbind list to add.

If you're wanting to specify your own enterprise OID,
then you probably need to use send_enterprise_trap_vars
Something like:

        oid myEntOid[] = { 1,3,6,1,..... };
        send_enterprise_trap_vars( SNMP_TRAP_ENTERPRISESPECIFIC, 1,
                                  myEntOid,  OID_LENGTH(myEntOid),
                                  myTrapVarbindList);

where myTrapVarbindList is the head of a list of the varbinds that
you want to include.





i can send a trap manualy like :

snmptrap -v 2c -c public localhost '' SIP-SER-MIB::sipserMaxUsersTrap SIP-SERVER-MIB::sipRegMaxUsers.1 u 2222





how can i handle that with send_easy_trap or sendv2_trap ?



With sendv2_trap, you'd need to create two 'netsnmp_variable_list' structures - holding

        snmpTrapOID.0 = SIP-SER-MIB::sipserMaxUsersTrap
and
        SIP-SERVER-MIB::sipRegMaxUsers.1 = 33

respectively (and linked together using 'next_variable')

With send_enterprise_trap_vars, you'd only need a varbind for
the sipRegMaxUsers.1 = 33 assignment, and would specify the
trap as

        send_enterprise_trap_vars( SNMP_TRAP_ENTERPRISESPECIFIC, N,
                                   sipserTrapPrefix, .... )

(where
        sipserMaxUsersTrap := { sipserTrapPrefix  N }
)


Dave







-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
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

Reply via email to