|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.dp.common.components.PollerClient | +--org.opennms.bb.dp.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 via JSDT
Field Summary | |
private com.sun.media.jsdt.Channel |
m_channel
The JSDT channel on which eventd is listening for messages |
private com.sun.media.jsdt.Session |
m_session
The JSDT session on which messages are sent to eventd |
private SnmpTrapSession |
m_trapSession
The trap session used by Trapd to receive traps |
private static long |
trapCount
|
Fields inherited from class org.opennms.bb.dp.common.components.PollerClient |
m_name |
Constructor Summary | |
Trapd()
Constructs a new Trapd object that receives and forwards trap messages via JSDT. |
|
Trapd(int port)
Constructs a new Trapd object that receives and forwards trap messages via JSDT. |
|
Trapd(String clientName)
Constructs a new Trapd object that receives and forwards trap messages via JSDT. |
|
Trapd(String clientName,
int port)
Constructs a new Trapd object that receives and forwards trap messages via JSDT. |
Method Summary | |
void |
close()
Closes the JSDT channel and the trap session |
private void |
connect()
Connect to the eventd JSDT channel |
static void |
main(String[] args)
Instantiate a trap listener |
void |
snmpReceivedTrap(SnmpTrapSession session,
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,
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,
Object ref)
Processes an error condition that occurs in the SnmpTrapSession. |
private void |
trapdInit(int port)
Create the SNMP trap session and create the JSDT communication channel to communicate with eventd. |
Methods inherited from class org.opennms.bb.dp.common.components.PollerClient |
authenticate, getName |
Methods inherited from class java.lang.Object |
|
Field Detail |
private SnmpTrapSession m_trapSession
private com.sun.media.jsdt.Session m_session
private com.sun.media.jsdt.Channel m_channel
private static long trapCount
Constructor Detail |
public Trapd() throws SocketException, com.sun.media.jsdt.JSDTException
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.
SocketException
- Thrown when the SnmpTrapSession
cannot create the datagram socketSecurityException
- Thrown if the security manager
disallows the creation of the handlerSnmpTrapSession
public Trapd(String clientName) throws SocketException, com.sun.media.jsdt.JSDTException
Constructs a new Trapd object that receives and forwards trap messages via JSDT. The trap session is started on the default port, as defined by the SNMP libarary.
clientName
- The JSDT client identifier for TrapdSocketException
- Thrown when the SnmpTrapSession
cannot create the datagram socketSecurityException
- Thrown if the security manager
disallows the creation of the handlerpublic Trapd(int port) throws SocketException, com.sun.media.jsdt.JSDTException
Constructs a new Trapd object that receives and forwards trap messages via JSDT. The session is initialized with the client name of OpenNMS.trapd:<port>. The trap session is started on the passed number.
port
- The port number for the trap session.SocketException
- Thrown when the SnmpTrapSession
cannot create the datagram socketSecurityException
- Thrown if the security manager
disallows the creation of the handlerpublic Trapd(String clientName, int port) throws SocketException, com.sun.media.jsdt.JSDTException
Constructs a new Trapd object that receives and forwards trap messages via JSDT. The new session is initialized with the passed JSDT client name and the defined trap port number.
clientName
- The name for this JSDT client.port
- The port number for the trap session.SocketException
- Thrown when the SnmpTrapSession
cannot create the datagram socketSecurityException
- Thrown if the security manager
disallows the creation of the handlerMethod Detail |
private void connect() throws com.sun.media.jsdt.JSDTException
InterruptedException
- Thrown if the running
thread is interrupted by another thread.private void trapdInit(int port) throws SocketException, com.sun.media.jsdt.JSDTException
port
- The port number where SNMP traps should be received.
If the port number is equal to -1 then the default port is used.SocketException
- Thrown when the SnmpTrapSession
cannot create the datagram socketSecurityException
- Thrown if the security manager
disallows the creation of the handlerSnmpTrapSession
,
SnmpTrapHandler
public void snmpReceivedTrap(SnmpTrapSession session, 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, 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, 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
Log
public void close()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |