SNMPv1 TRAPS

Frank Fock Frank.Fock____t-online.de
Sat Sep 22 10:58:37 CEST 2001


Hi Kumar,

You should write a SMIv2 MIB to define your traps, since SMIv1
is no longer allowed. Then you have to make sure that your
NOTIFICATION OID has a "0" (zero) as second to last subidentifier.
Then you will be able to use that OID with SNMPv1 traps too.

Then your code snippet will look like this:
       Vbx* vbs = new Vbx[2];
       vbs[0].set_oid(prop1Oid);
       vbs[0].set_value(prop1Value);
       vbs[1].set_oid(prop2Oid);
       vbs[1].set_value(prop2Value);
       notification_originator->add_v1_trap_destination(*destination);
        notification_originator->generate(vbs, 2, myTrapOid, TimeOut,
"");

Where myTrapOid is the OID from the SMIv2 NOTIFICATION-TYPE.

Regards,
Frank

"Kumar, Vinay 2" wrote:

> hi,
>
> i've just started working on SNMPv1 traps
> i've created a mib having a Table
> & now i want to send traps on every change in the value of the property of
> the table
>
> if my table is
>          IfEntry ::= SEQUENCE                   // OID =
> 1.3.6.1.4.1.100.10.2.1.1
>                 {
>                         prop1   DisplayString,  // OID = 1
>                         prop2    INTEGER        // OID = 2
>                 }
>
> then is the follwing definition correct for the specific trap :
>
>         myPropChange TRAP-TYPE
>                         ENTERPRISE                      ???     // What do i
> give here, since in your docs you have said that you don't specify
> anything("") in case of SNMPv1
>                         VARIABLES                       { prop1, prop2 }
>                         DESCRIPTION
>                         "This TRAP is fired at the each & every change of
> property"
>                         REFERENCE                       "[specific-trap]"
>                         ::= 4
>
> how can i reflect these changes in my source code :
> the following code send simple notifications & send changed property OID in
> the ENTERPRISE value of the trap
>         Vbx* vbs = NULL;
>         notification_originator->add_v1_trap_destination(*destination);
>         notification_originator->generate(vbs, 0, MyPropertyOid, TimeOut,
> "");    // Where MyPropertyOid = OID [ prop1 / prop2 ]
>
> how can i send the values in the TRAP notification, i.e if prop1 changes
> then i need the oid & value of prop1 only
>         Vbx* vbs = new Vbx(MyPropertyOid, "Value");             // ???is
> this correct, if not then how do i.. ?
>
> whenever i'm sending traps to port 162, then
> why we get 2 notifications for the traps
> one on the static IP address of the PC & the other one on 127.0.0.1
>
> Any help will be appreciated.
>




More information about the AGENTPP mailing list