public class SnmpTrapHelper extends Object
| Constructor and Description | 
|---|
SnmpTrapHelper()
Constructs a new SNMPTrapHelper. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addVarBinding(SnmpTrapBuilder trap,
             String name,
             String type,
             String value)
Create a new variable binding and add it to the specified SNMP V1 trap. 
 | 
void | 
addVarBinding(SnmpTrapBuilder trap,
             String name,
             String type,
             String encoding,
             String value)
Create a new variable binding and add it to the specified SNMP V1 trap. 
 | 
SnmpV1TrapBuilder | 
createV1Trap(String entId,
            String agentAddr,
            int generic,
            int specific,
            long timeStamp)
Create an SNMP V1 trap with the specified enterprise IS, agent address,
 generic ID, specific ID, and time stamp. 
 | 
SnmpV2TrapBuilder | 
createV2Inform(String trapOid,
              String sysUpTime)
Create an SNMP V2 inform with the specified trap object ID, and sysUpTime
 value. 
 | 
SnmpTrapBuilder | 
createV2Trap(String trapOid,
            String sysUpTime)
Create an SNMP V2 trap with the specified trap object ID, and sysUpTime
 value. 
 | 
SnmpV3TrapBuilder | 
createV3Inform(String trapOid,
              String sysUpTime)
Create an SNMP V3 trap with the specified trap object ID, and sysUpTime
 value. 
 | 
SnmpV3TrapBuilder | 
createV3Trap(String trapOid,
            String sysUpTime)
Create an SNMP V3 trap with the specified trap object ID, and sysUpTime
 value. 
 | 
void | 
forwardTrap(Event event,
           String destAddr,
           int destPort)
Create an SNMP trap, based on the content of the specified event, and
 forward the trap to the specified address and port. 
 | 
void | 
forwardV1Trap(Event event,
             String destAddr,
             int destPort)
Create an SNMP V1 trap, based on the content of the specified event, and
 forward the trap to the specified address and port. 
 | 
void | 
forwardV2Trap(Event event,
             String destAddr,
             int destPort)
Create an SNMP V2 trap, based on the content of the specified event, and
 forward the trap to the specified address and port. 
 | 
String | 
getLocalEngineID()
This helper method helps SNMP trap daemon
 administrator to set up authentication
 An snmpv3 trap is sent using the sender 
 EngineID that needs to be known 
 over remote trap receivers 
 | 
void | 
sendTL1AutonomousMsgTrap(Event event,
                        String destAddr,
                        int destPort,
                        String trapVersion,
                        String community)
Create an SNMP trap, based on the content of an event derived from a
 TL1 autonomous message received by Tl1d, and forward the trap to the
 specified address and port. 
 | 
void | 
stop()
Stops the SnmpTrapHelper. 
 | 
public void stop()
public SnmpV1TrapBuilder createV1Trap(String entId, String agentAddr, int generic, int specific, long timeStamp) throws UnknownHostException
entId - The enterprise ID for the trap.agentAddr - The agent address for the trap.generic - The generic ID for the trap.specific - The specific ID for the trap.timeStamp - The time stamp for the trap.UnknownHostException - if any.public SnmpTrapBuilder createV2Trap(String trapOid, String sysUpTime) throws SnmpTrapHelperException
trapOid - The trap object id.sysUpTime - The system up time.Throws - SnmpTrapHelperException if the trap cannot be created for
                any reason.SnmpTrapHelperException - if any.public SnmpV2TrapBuilder createV2Inform(String trapOid, String sysUpTime) throws SnmpTrapHelperException
trapOid - The trap object id.sysUpTime - The system up time.Throws - SnmpTrapHelperException if the trap cannot be created for
                any reason.SnmpTrapHelperException - if any.public SnmpV3TrapBuilder createV3Trap(String trapOid, String sysUpTime) throws SnmpTrapHelperException
trapOid - The trap object id.sysUpTime - The system up time.Throws - SnmpTrapHelperException if the trap cannot be created for
                any reason.SnmpTrapHelperException - if any.public SnmpV3TrapBuilder createV3Inform(String trapOid, String sysUpTime) throws SnmpTrapHelperException
trapOid - The trap object id.sysUpTime - The system up time.Throws - SnmpTrapHelperException if the trap cannot be created for
                any reason.SnmpTrapHelperException - if any.public String getLocalEngineID()
public void addVarBinding(SnmpTrapBuilder trap, String name, String type, String value) throws SnmpTrapHelperException
trap - The trap to which the variable binding should be added.name - The name (a.k.a. "id") of the variable binding to be createdtype - The type of variable binding to be createdvalue - The variable binding valueThrows - SnmpTrapHelperException if the variable binding cannot be
                added to the trap for any reason.SnmpTrapHelperException - if any.public void addVarBinding(SnmpTrapBuilder trap, String name, String type, String encoding, String value) throws SnmpTrapHelperException
trap - The trap to which the variable binding should be added.name - The name (a.k.a. "id") of the variable binding to be createdtype - The type of variable binding to be createdencoding - Describes the way in which the value content has been encoded
            (i.e. XML_ENCODING_TEXT, or XML_ENCODING_BASE64)value - The variable binding valueThrows - SnmpTrapHelperException if the variable binding cannot be
                added to the trap for any reason.SnmpTrapHelperException - if any.public void forwardV1Trap(Event event, String destAddr, int destPort) throws SnmpTrapHelperException
event - The event upon which the trap content should be baseddestAddr - The address to which the trap should be forwardeddestPort - The port to which the trap should be forwardedThrows - SnmpTrapHelperException if the variable binding cannot be
                added to the trap for any reason.SnmpTrapHelperException - if any.public void forwardV2Trap(Event event, String destAddr, int destPort) throws SnmpTrapHelperException
event - The event upon which the trap content should be baseddestAddr - The address to which the trap should be forwardeddestPort - The port to which the trap should be forwardedThrows - SnmpTrapHelperException if the variable binding cannot be
                added to the trap for any reason.SnmpTrapHelperException - if any.public void forwardTrap(Event event, String destAddr, int destPort) throws SnmpTrapHelperException
event - The event upon which the trap content should be baseddestAddr - The address to which the trap should be forwardeddestPort - The port to which the trap should be forwardedThrows - SnmpTrapHelperException if the variable binding cannot be
                added to the trap for any reason.SnmpTrapHelperException - if any.public void sendTL1AutonomousMsgTrap(Event event, String destAddr, int destPort, String trapVersion, String community) throws SnmpTrapHelperException, UnknownHostException
event - The event upon which the trap content should be baseddestAddr - The address to which the trap should be sentdestPort - The port to which the trap should be senttrapVersion - The SNMP version ("v1" or "v2c") of the trapcommunity - The SNMP community string for the trap (defaults to "public")SnmpTrapHelperException - if any.UnknownHostException - if any.Throws - SnmpTrapHelperException if the event is not of the appropriate type.Throws - UnknownHostException if agent-addr resolution fails for the case of an SNMPv1 trapThrows - SnmpTrapHelperException if the event is not of the appropriate type.Throws - UnknownHostException if agent-addr resolution fails for the case of an SNMPv1 trapCopyright © 2020. All rights reserved.