org.opennms.netmgt.trapd
Class Trapd

java.lang.Object
  extended by org.opennms.netmgt.daemon.AbstractServiceDaemon
      extended by org.opennms.netmgt.trapd.Trapd
All Implemented Interfaces:
Fiber, PausableFiber, SpringServiceDaemon, ServiceDaemon, TrapNotificationListener, TrapProcessorFactory, org.springframework.beans.factory.InitializingBean

public class Trapd
extends AbstractServiceDaemon
implements PausableFiber, TrapProcessorFactory, TrapNotificationListener, org.springframework.beans.factory.InitializingBean

The Trapd listens for SNMP traps on the standard port(162). Creates a SnmpTrapSession and implements the SnmpTrapHandler to get callbacks when traps are received

The received traps are converted into XML and sent to eventd

Note: Trapd is a PausableFiber so as to receive control events. However, a 'pause' on Trapd has no impact on the receiving and processing of traps

Author:
Brian Weaver , Sowmya Nataraj , Lawrence Karnowski , Mike Davidson , Tarus Balog , OpenNMS.org

Field Summary
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
Trapd()
           Constructs a new Trapd object that receives and forwards trap messages via JSDT.
 
Method Summary
 TrapProcessor createTrapProcessor()
           
 FifoQueue<TrapNotification> getBacklogQ()
           
 BroadcastEventProcessor getEventReader()
           
 org.opennms.netmgt.trapd.TrapQueueProcessor getProcessor()
           
 int getSnmpTrapPort()
           
 int getStatus()
          Returns the current status of the service.
 TrapdIpMgr getTrapdIpMgr()
           
 void onInit()
           
 void onPause()
          Pauses Trapd
 void onResume()
          Resumes Trapd
 void onStart()
          Create the SNMP trap session and create the communication channel to communicate with eventd.
 void onStop()
          Stops the currently running service.
 void setBacklogQ(FifoQueue<TrapNotification> backlogQ)
           
 void setEventReader(BroadcastEventProcessor eventReader)
           
 void setProcessor(org.opennms.netmgt.trapd.TrapQueueProcessor processor)
           
 void setSnmpTrapPort(int snmpTrapPort)
           
 void setTrapdIpMgr(TrapdIpMgr trapdIpMgr)
           
 void trapError(int error, String msg)
           
 void trapReceived(TrapNotification trapNotification)
           
 
Methods inherited from class org.opennms.netmgt.daemon.AbstractServiceDaemon
afterPropertiesSet, debugf, debugf, errorf, errorf, fatalf, fatalf, getName, getStatusText, infof, infof, init, isPaused, isRunning, isStarting, isStartPending, log, pause, resume, setStatus, start, status, stop, waitForStatus, waitForStatus, warnf, warnf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opennms.core.fiber.PausableFiber
pause, resume
 
Methods inherited from interface org.opennms.core.fiber.Fiber
getName, start, stop
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 

Constructor Detail

Trapd

public Trapd()

Constructs a new Trapd object that receives and forwards trap messages via JSDT. The session is initialized with the default client name of OpenNMS.trapd. The trap session is started on the default port, as defined by the SNMP libarary.

See Also:
SnmpTrapSession
Method Detail

createTrapProcessor

public TrapProcessor createTrapProcessor()
Specified by:
createTrapProcessor in interface TrapProcessorFactory

trapReceived

public void trapReceived(TrapNotification trapNotification)
Specified by:
trapReceived in interface TrapNotificationListener

onInit

public void onInit()
Specified by:
onInit in class AbstractServiceDaemon

onStart

public void onStart()
Create the SNMP trap session and create the communication channel to communicate with eventd.

Overrides:
onStart in class AbstractServiceDaemon
Throws:
UndeclaredThrowableException - if an unexpected database, or IO exception occurs.
See Also:
SnmpTrapSession, SnmpTrapHandler

onPause

public void onPause()
Pauses Trapd

Overrides:
onPause in class AbstractServiceDaemon

onResume

public void onResume()
Resumes Trapd

Overrides:
onResume in class AbstractServiceDaemon

onStop

public void onStop()
Stops the currently running service. If the service is not running then the command is silently discarded.

Overrides:
onStop in class AbstractServiceDaemon

getStatus

public int getStatus()
Returns the current status of the service.

Specified by:
getStatus in interface Fiber
Overrides:
getStatus in class AbstractServiceDaemon
Returns:
The service's status.

trapError

public void trapError(int error,
                      String msg)
Specified by:
trapError in interface TrapNotificationListener

getTrapdIpMgr

public TrapdIpMgr getTrapdIpMgr()

setTrapdIpMgr

public void setTrapdIpMgr(TrapdIpMgr trapdIpMgr)

getEventReader

public BroadcastEventProcessor getEventReader()

setEventReader

public void setEventReader(BroadcastEventProcessor eventReader)

getBacklogQ

public FifoQueue<TrapNotification> getBacklogQ()

setBacklogQ

public void setBacklogQ(FifoQueue<TrapNotification> backlogQ)

getProcessor

public org.opennms.netmgt.trapd.TrapQueueProcessor getProcessor()

setProcessor

public void setProcessor(org.opennms.netmgt.trapd.TrapQueueProcessor processor)

getSnmpTrapPort

public int getSnmpTrapPort()

setSnmpTrapPort

public void setSnmpTrapPort(int snmpTrapPort)


Copyright © 2009. All Rights Reserved.