my code now is :

oid  notification_oid[] ={1, 3, 6, 1, 6, 3, 1, 1, 5, 3};
        size_t notification_oid_len =OID_LENGTH(notification_oid);
        oid  objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
        size_t  objid_snmptrap_len =OID_LENGTH(objid_snmptrap);//linux4biz
        snmp_varlist_add_variable(&notification_vars, objid_snmptrap,
objid_snmptrap_len, ASN_OBJECT_ID, (u_char *)notification_oid,
notification_oid_len);
send_v2trap(notification_vars);

I want to send a linkDown trap (1.3.6.1.6.3.1.1.5.3), everything ok,
but i don't understand why in snmptrapd log messages i don't see a
word linkDown trap or something like that?

the log message is :

Apr  6 20:19:36 max snmptrapd[4273]: <UNKNOWN> [UDP:
[192.168.168.112]:41105->[192.168.168.6]]: Trap ,
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (281144) 0:46:51.44,
SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::org





2010/3/22 Dave Shield <[email protected]>:
> On 22 March 2010 12:07, maxim maxim <[email protected]> wrote:
>> it's my code for sending trap from subagent:
>>
>>        oid  notification_oid[] ={1, 3, 6, 1, 6, 3, 1, 1, 5, 3};
>>        size_t notification_oid_len = OID_LENGTH(notification_oid);
>
> OK - that's setting the OID of the trap that you wish to send.
>
>
>>        oid  objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 5, 3 };
>>        size_t  objid_snmptrap_len =OID_LENGTH(objid_snmptrap);
>
> Not OK!   Why have you changed this OID?
>
> The OID of the object  SNMPv2-MIB::snmpTrapOID is 1.3.6.1.3.1.1.4.1
> So this second value should be left as
>
>        oid  objid_snmptrap[] = { 1, 3, 6, 1, 3, 1, 1, 4, 1, 0 };
>
>
>
>
>
>> I don't understand why the trap is not send. what's wrong here?
>
> The first varbind in the payload specifies which trap you are sending.
> This is of the form
>
>    snmpTrapOID.0 =  {theOIDofMyTrap}
>
>
> You've changed this to be
>
>    theOIDofMyTrap = {theOIDofMyTrap}
>
> which is wrong.
> The agent trap-handling code looks for the snmpTrapOID.0 assignment,
> and rejects any request where this doesn't appear.
>
>
> Dave
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to