|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.trapd.Trapd
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
Nested Class Summary | |
(package private) static class |
Trapd.V1TrapInformation
V1 trap element for processing by the queue reader |
(package private) static class |
Trapd.V2TrapInformation
V2 Trap information object for processing by the queue reader |
Field Summary | |
private static java.lang.String |
GET_KNOWN_IPS
SQL to get already kown IPs |
private static java.lang.String |
LOG4J_CATEGORY
The name of the logging category for Trapd. |
private FifoQueue |
m_backlogQ
The communication queue |
private BroadcastEventProcessor |
m_eventReader
The class instance used to recieve new events from for the system. |
private java.util.Map |
m_knownIps
The list of known IPs |
private java.lang.String |
m_name
The name of this service. |
private TrapQueueProcessor |
m_processor
The queue processing thread |
private static Trapd |
m_singleton
The singlton instance. |
private int |
m_status
The last status sent to the service control manager. |
private SnmpTrapSession |
m_trapSession
The trap session used by Trapd to receive traps |
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 | |
static Trapd |
getInstance()
Returns the singular instance of the trapd daemon. |
java.lang.String |
getName()
Returns the name of the service. |
int |
getStatus()
Returns the current status of the service. |
void |
init()
|
void |
pause()
Pauses Trapd |
void |
resume()
Resumes Trapd |
void |
snmpReceivedTrap(SnmpTrapSession session,
java.net.InetAddress agent,
int port,
SnmpOctetString community,
SnmpPduPacket pdu)
Process the recieved SNMP v2c trap that was received by the underlying trap session. |
void |
snmpReceivedTrap(SnmpTrapSession session,
java.net.InetAddress agent,
int port,
SnmpOctetString community,
SnmpPduTrap pdu)
Process the recieved SNMP v1 trap that was received by the underlying trap session. |
void |
snmpTrapSessionError(SnmpTrapSession session,
int error,
java.lang.Object ref)
Processes an error condition that occurs in the SnmpTrapSession. |
void |
start()
Create the SNMP trap session and create the JSDT communication channel to communicate with eventd. |
void |
stop()
Stops the currently running service. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String LOG4J_CATEGORY
private static final java.lang.String GET_KNOWN_IPS
private static final Trapd m_singleton
private SnmpTrapSession m_trapSession
private java.lang.String m_name
private int m_status
private FifoQueue m_backlogQ
private java.util.Map m_knownIps
private TrapQueueProcessor m_processor
private BroadcastEventProcessor m_eventReader
Constructor Detail |
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.
SnmpTrapSession
Method Detail |
public void snmpReceivedTrap(SnmpTrapSession session, java.net.InetAddress agent, int port, SnmpOctetString community, SnmpPduPacket pdu)
Process the recieved SNMP v2c trap that was received by the underlying trap session.
snmpReceivedTrap
in interface SnmpTrapHandler
session
- The trap session that received the datagram.agent
- The remote agent that sent the datagram.port
- The remmote port the trap was sent from.community
- The community string contained in the message.pdu
- The protocol data unit containing the datapublic void snmpReceivedTrap(SnmpTrapSession session, java.net.InetAddress agent, int port, SnmpOctetString community, SnmpPduTrap pdu)
Process the recieved SNMP v1 trap that was received by the underlying trap session.
snmpReceivedTrap
in interface SnmpTrapHandler
session
- The trap session that received the datagram.agent
- The remote agent that sent the datagram.port
- The remmote port the trap was sent from.community
- The community string contained in the message.pdu
- The protocol data unit containing the datapublic void snmpTrapSessionError(SnmpTrapSession session, int error, java.lang.Object ref)
Processes an error condition that occurs in the SnmpTrapSession. The errors are logged and ignored by the trapd class.
snmpTrapSessionError
in interface SnmpTrapHandler
session
- The SNMP Trap Sessionerror
- The error condition value.ref
- The PDU reference, or potentially null. It may also be an
exception.public void init()
public void start()
start
in interface Fiber
java.lang.reflect.UndeclaredThrowableException
- if an unexpected database, or IO exception occurs.SnmpTrapSession
,
SnmpTrapHandler
public void pause()
pause
in interface PausableFiber
public void resume()
resume
in interface PausableFiber
public void stop()
stop
in interface Fiber
public int getStatus()
getStatus
in interface Fiber
public java.lang.String getName()
getName
in interface Fiber
public static Trapd getInstance()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |