Re: Sending traps with dynamic destinations

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
    [ First - *please* don't mail me privately, without copying
     any responses to the mailing list.  I don't have the time
     or inclination to offer private, unpaid, SNMP consultancy.
     Keep discussions to the list, where others can both learn
     and offer advice.  Thanks.   ]

On 08/02/07, jin zhou <[email protected]> wrote:
>   Thank you .But I find it is boring when the trap receivers is not just
> only 1,while I should revaluate the session variable to send traps to
> different receivers for many times.Can session.peername include several
> destinations or is there any way to resolve this problem?

For each destination, you'll need to open a new session.
But you can use the same template for each of them.
Something like:

    session.version = SNMP_VERSION2c;
    session.community = "public";

    session.remotepeer = "trapdest1:162";
    ss1 = snmp_open( &session );
    session.remotepeer = "trapdest2:162";
    ss2 = snmp_open( &session );
    session.remotepeer = "trapdest3:162";
    ss3 = snmp_open( &session );

    pdu = snmp_pdu_create(SNMP_MSG_TRAP2);
    snmp_send( ss1, pdu );
    snmp_send( ss2, pdu );
    snmp_send( ss3, pdu );


If you're going to be sending several traps to the same destinations,
then you could re-use the ss1,ss2,ss3  structures from one time
to the next - rather than re-creating them every time.



Note that the code above is a gross oversimplification, and is
almost certainly not correct (as well as being incomplete).  But
it should give you the basic idea.

Dave

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.