[SNMP4J] SNMP v1 trap

Mark Stang mstang at pingidentity.com
Tue Jul 17 01:08:43 CEST 2007


Hi,
I am trying to set up a periodic Trap, which I have running just fine.  However, I need to set up a second Trap as a Test Trap until the user decides to persist the data.  At that time, I need to cancel the old Trap and create a new one.  All of which I can do except I am not sure which variables I can just make changes to/share and which ones I need to create "new" ones of.

For instance, I can create an instance of the Snmp class, but it needs a transport.  Does that mean each time I create a new instance of Snmp I have to create a new instance of the transport?  And what about the CommunityTarget.

  transport = new DefaultUdpTransportMapping();
  snmp = new Snmp(transport);
  transport.listen();
  // setting up target
  target = new CommunityTarget();

I need to be able to save off the old ones to kill them.

    private void cancelTimer()
    {
        if (timerTask != null)
        {
            log.debug("Canceling Heartbeat Timer");
            timerTask.cancel();
        }
    }

When the timer task stops what does it have to do to kill the Trap?

And finally, how much code do I need to just "send"?  Should I re-create the instance of Snmp or just call the send method on it?

thanks,

Mark
Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



More information about the SNMP4J mailing list