Example of configuring trap recipients?

Jeff Stewart jstewart____remarq.com
Tue Feb 8 19:23:23 CET 2000


Frank,
    Thanks for the code snippet.  The contents of those add_entry functions would
be very helpful to me.  I'm working through how to add the necessary rows to the
tables.  Just knowing what data needs to go in what columns helps a lot.
    Jeff

Frank Fock wrote:

> Hi Jeff,
>
> for the AGENT++3.4 release I have implemented an easy to use
> method to add an v1 trap destination. It adds an entry (row) to
> each of the following tables:
>
> 1. snmpTargetParamsTable
> 2. snmpTargetAddrTable
> 3. snmpNotifyTable
>
> The ::add_entry methods referenced in the examples code
> attached are not implemented in release 3.3. If you would
> like to get the code - just email me.
>
> Best regards,
> Frank
>
> Jeff Stewart wrote:
>
> >     I'm trying to get a small custom agent running using Agent++.  I've
> > got the library built and working for a small proxying server.  Now I'm
> > trying to originate some traps, starting with a coldStart trap.  The
> > code to originate the trap seems straightforward.
> >     Unfortunately, what I can't figure out is how I configure the trap
> > recipients.  It looks like I need to add a row to the
> > snmpNotifyEntry::instance and one to the snmpTargetAddrEntry::instance.
> >     Does anyone have an example of setting up these tables, either from
> > persistent storage, or programmatically?  Even just knowing what the
> > fields are supposed to be would help.  Here's what I've guessed so far:
> >
> >     snmpNotifyEntry: text Label?, trap(1)/notify(2), persistence?,
> > async(4)/block(5)
> >     snmpTargetAddrEntry: ?
> >
> >     Jeff
>
>   ------------------------------------------------------------------------
> boolean NotificationOriginator::add_v1_trap_destination(const UdpAddress& addr)
> {
>         OctetStr name("defaultV1Trap");
>         OctetStr tag("v1trap");
>         if (snmpTargetParamsEntry::instance->add_entry(name, // row index
>                                                        1,    // mpModel
>                                                        1,    // securityModel
>                                                        "public", // secName
>                                                        1)) { // secLevel
>           OctetStr address;
>           for (int i=0; i<4; i++) {
>                 address += addr[i];
>           }
>           address += addr.get_port() >> 1;
>           address += addr.get_port() & 0x0F;
>           if (snmpTargetAddrEntry::instance->
>               add_entry(name,                     // row index
>                         Oidx("1.3.6.1.6.1.1"),    // UDP domain
>                         address,                  // target address
>                         tag,                      // tag
>                         name)) {                  // params entry
>             if (snmpNotifyEntry::instance->add_entry(name, // row index
>                                                      tag,  // tag
>                                                      1))   // type (trap)
>                 return TRUE;
>           }
>         }
>         return FALSE;
> }




More information about the AGENTPP mailing list