public class Trapd extends AbstractServiceDaemon implements TrapProcessorFactory, TrapNotificationListener
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.
PAUSE_PENDING, PAUSED, RESUME_PENDING
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
Constructor and Description |
---|
Trapd()
Constructs a new Trapd object that receives and forwards trap messages
via JSDT.
|
Modifier and Type | Method and Description |
---|---|
TrapProcessor |
createTrapProcessor()
createTrapProcessor
|
ExecutorService |
getBacklogQ()
getBacklogQ
|
BroadcastEventProcessor |
getEventReader()
getEventReader
|
static String |
getLoggingCategory() |
int |
getStatus()
Returns the current status of the service.
|
long |
getTrapsDiscarded() |
long |
getTrapsErrored() |
long |
getV1TrapsReceived() |
long |
getV2cTrapsReceived() |
long |
getV3TrapsReceived() |
void |
onInit()
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(ExecutorService backlogQ)
setBacklogQ
|
void |
setEventReader(BroadcastEventProcessor eventReader)
setEventReader
|
void |
trapError(int error,
String msg) |
void |
trapReceived(TrapNotification trapNotification) |
afterPropertiesSet, destroy, getName, getStatusText, init, isPaused, isRunning, isStarting, pause, resume, setStatus, start, status, stop, waitForStatus, waitForStatus
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.
SnmpTrapSession
public TrapProcessor createTrapProcessor()
createTrapProcessor
createTrapProcessor
in interface TrapProcessorFactory
TrapProcessor
object.public void trapReceived(TrapNotification trapNotification)
trapReceived
in interface TrapNotificationListener
public void onInit()
onInit
onInit
in class AbstractServiceDaemon
public void onStart()
onStart
in class AbstractServiceDaemon
UndeclaredThrowableException
- if an unexpected database, or IO exception occurs.SnmpTrapSession
,
SnmpTrapHandler
public void onPause()
onPause
in class AbstractServiceDaemon
public void onResume()
onResume
in class AbstractServiceDaemon
public void onStop()
onStop
in class AbstractServiceDaemon
public int getStatus()
getStatus
in interface Fiber
getStatus
in class AbstractServiceDaemon
public void trapError(int error, String msg)
trapError
in interface TrapNotificationListener
public BroadcastEventProcessor getEventReader()
getEventReader
BroadcastEventProcessor
object.public void setEventReader(BroadcastEventProcessor eventReader)
setEventReader
eventReader
- a BroadcastEventProcessor
object.public ExecutorService getBacklogQ()
getBacklogQ
ExecutorService
object.public void setBacklogQ(ExecutorService backlogQ)
setBacklogQ
backlogQ
- a ExecutorService
object.public static String getLoggingCategory()
public long getV1TrapsReceived()
public long getV2cTrapsReceived()
public long getV3TrapsReceived()
public long getTrapsDiscarded()
public long getTrapsErrored()
Copyright © 2015. All rights reserved.