Package org.opennms.netmgt.trapd
Class Trapd
- java.lang.Object
-
- org.opennms.netmgt.daemon.AbstractServiceDaemon
-
- org.opennms.netmgt.trapd.Trapd
-
- All Implemented Interfaces:
Fiber
,PausableFiber
,SpringServiceDaemon
,ServiceDaemon
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
public class Trapd extends AbstractServiceDaemon
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 Modifier and Type Field Description static java.lang.String
LOG4J_CATEGORY
-
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
-
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
-
-
Constructor Summary
Constructors Constructor Description Trapd()
Constructs a new Trapd object that receives and forwards trap messages via JSDT.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getLoggingCategory()
int
getStatus()
Returns the current status of the service.void
handleReloadEvent(IEvent e)
protected void
onInit()
onInitprotected void
onPause()
Pauses Trapdprotected void
onResume()
Resumes Trapdprotected void
onStart()
Create the SNMP trap session and create the communication channel to communicate with eventd.protected void
onStop()
Stops the currently running service.-
Methods inherited from class org.opennms.netmgt.daemon.AbstractServiceDaemon
afterPropertiesSet, destroy, getName, getStatusText, init, isPaused, isRunning, isStarting, pause, resume, setStatus, start, status, stop, waitForStatus, waitForStatus
-
-
-
-
Field Detail
-
LOG4J_CATEGORY
public static final java.lang.String LOG4J_CATEGORY
- See Also:
- Constant Field Values
-
-
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 library.
- See Also:
SnmpTrapSession
-
-
Method Detail
-
onInit
protected void onInit()
onInit
- Specified by:
onInit
in classAbstractServiceDaemon
-
onStart
protected void onStart()
Create the SNMP trap session and create the communication channel to communicate with eventd.- Overrides:
onStart
in classAbstractServiceDaemon
- Throws:
java.lang.reflect.UndeclaredThrowableException
- if an unexpected database, or IO exception occurs.- See Also:
SnmpTrapSession
,SnmpTrapHandler
-
onPause
protected void onPause()
Pauses Trapd- Overrides:
onPause
in classAbstractServiceDaemon
-
onResume
protected void onResume()
Resumes Trapd- Overrides:
onResume
in classAbstractServiceDaemon
-
onStop
protected void onStop()
Stops the currently running service. If the service is not running then the command is silently discarded.- Overrides:
onStop
in classAbstractServiceDaemon
-
getStatus
public int getStatus()
Returns the current status of the service.- Specified by:
getStatus
in interfaceFiber
- Overrides:
getStatus
in classAbstractServiceDaemon
- Returns:
- The service's status.
-
handleReloadEvent
public void handleReloadEvent(IEvent e)
-
getLoggingCategory
public static java.lang.String getLoggingCategory()
-
-