|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.mccrory.scott.spumoni.SnmpTrapAgent
SnmpTrapAgent is a class that sends SNMP V1 or V2 traps to
one (and only one) SNMP manager defined by its IP address and port number.
SnmpTrapAgent is an adaptation of JoeSNMP's SnmpAgent test class, which
is a part of the OpenNMS project.
Thanks go out to Brian Weaver and the rest of the OpenNMS crew for their
excellent work.
| Constructor Summary | |
SnmpTrapAgent(java.lang.String managerAddress,
int managerPort,
java.lang.String trapOid)
Builds an snmpagent object for sending SNMP V1 or V2 traps. |
|
| Method Summary | |
java.lang.Object |
clone()
We override the clone method here to prevent cloning of our class. |
void |
close()
Closes the SNMP session. |
static void |
main(java.lang.String[] args)
For unit testing. |
void |
sendV1Trap(java.lang.String message)
Sends a formatted message as SNMP V1 trap. |
void |
sendV2Trap(java.lang.String message)
Sends a formatted message as SNMP V2 trap. |
void |
snmpInternalError(org.opennms.protocols.snmp.SnmpSession session,
int err,
org.opennms.protocols.snmp.SnmpSyntax pdu)
Stubbed out since we are only sending |
void |
snmpReceivedPdu(org.opennms.protocols.snmp.SnmpSession session,
int cmd,
org.opennms.protocols.snmp.SnmpPduPacket pdu)
Stubbed out since we are only sending |
void |
snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession session,
org.opennms.protocols.snmp.SnmpSyntax pdu)
Stubbed out since we are only sending |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SnmpTrapAgent(java.lang.String managerAddress,
int managerPort,
java.lang.String trapOid)
throws java.lang.Exception
Remark : The SNMP trap type (V1 or V2) will be set every time a trap is sent in the respectie send method.
managerAddress - the IP address where the traps are sentmanagerPort - the port number where the traps are sent (e.g. 162)trapOid - the complete OID for the trap (e.g. "1.3.6.1.2.1.1232.1.1")java.lang.Exception - if an error occurs during the initialization
of the object| Method Detail |
public final java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone method here to prevent cloning of our class.
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - To indicate cloning is not allowedpublic void close()
public static void main(java.lang.String[] args)
args - an array of command-line arguments
public void sendV1Trap(java.lang.String message)
throws java.lang.Exception
message - the formatted text to sendjava.lang.Exception - if an error occurs during the sending of the trap
public void sendV2Trap(java.lang.String message)
throws java.lang.Exception
message - the formatted text to sendjava.lang.Exception - if an error occurs during the sending of the trap
public void snmpInternalError(org.opennms.protocols.snmp.SnmpSession session,
int err,
org.opennms.protocols.snmp.SnmpSyntax pdu)
snmpInternalError in interface org.opennms.protocols.snmp.SnmpHandlersession - The SnmpSession we're communicating witherr - The error numberpdu - The SNMP Packet Data Unit
public void snmpReceivedPdu(org.opennms.protocols.snmp.SnmpSession session,
int cmd,
org.opennms.protocols.snmp.SnmpPduPacket pdu)
snmpReceivedPdu in interface org.opennms.protocols.snmp.SnmpHandlersession - The SnmpSession we're communicating withcmd - The SNMP commandpdu - The SNMP Packet Data Unit
public void snmpTimeoutError(org.opennms.protocols.snmp.SnmpSession session,
org.opennms.protocols.snmp.SnmpSyntax pdu)
snmpTimeoutError in interface org.opennms.protocols.snmp.SnmpHandlersession - The SnmpSession we're communicating withpdu - The SNMP Packet Data Unit
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||