1 Mar 2011 16:49
Invalid trap checksum??
I have created a java program using SNMP4J which generates and sends an
SNMP v1 trap. The basic code looks like this:
private void sendTrap(String alertMsg) {
OID oid = new OID("1.2.3.4.5.2");
try {
PDUv1 pdu = new PDUv1();
pdu.setType(PDU.V1TRAP);
pdu.setAgentAddress(new IpAddress("2.2.2.2"));
pdu.setGenericTrap(PDUv1.ENTERPRISE_SPECIFIC);
pdu.setSpecificTrap(1);
pdu.setEnterprise(oid);
pdu.add(new VariableBinding(oid, new OctetString(alertMsg)));
CommunityTarget comTarget = new CommunityTarget();
comTarget.setCommunity(new OctetString(snmpCommunity));
comTarget.setVersion(SnmpConstants.version1);
comTarget.setAddress(new UdpAddress("1.2.3.4/162")); //
Host address is actuall a valid address...
comTarget.setRetries(2);
comTarget.setTimeout(5000);
TransportMapping transport = new DefaultUdpTransportMapping();
Snmp snmp = new Snmp(transport);
snmp.send(pdu, comTarget);
snmp.close();
transport.close();
transport = null;
(Continue reading)
RSS Feed