TrapListenerImpl.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /* $Id: TrapListenerImpl.java,v 1.3 2002/09/09 05:45:01 tonyjpaul Exp $ */
- /*
- * @(#)TrapListenerImpl.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the COPYRIGHTS file for more
- */
- import java.util.*;
- import com.adventnet.snmp.snmp2.*;
- import com.adventnet.snmp.mibs.*;
- public class TrapListenerImpl extends
- com.adventnet.snmp.corba._TrapListenerImplBase
- {
-
- // This method is called when trap is received by SnmpTrapReceiver
- public void receivedTrap(com.adventnet.snmp.corba.TrapEvent trap) {
- //com.adventnet.snmp.beans.TrapEvent event = ((com.adventnet.snmp.corba.TrapEventImpl)trap).trapEvent;
- System.out.println("Got a trap from:" + trap.remoteHost );
- // print PDU details
- try {
- //System.out.println( receiver.getMibOperations()
- //.toString(trap.getTrapPDU()) );
- System.out.println( " Opts: "+trap.enterprise
- +" - " + trap.trapType
- +" - " + trap.specificType );
- // get trap defn
- System.out.println("Trap Name: "+trap.trapName
- +"nDescr: "+trap.trapDescr);
- } catch (Exception ex) {
- System.err.println( "Error: "+ex);
- ex.printStackTrace();
- }
- }
- }