[SNMP4J] Question on sending v2c trap

Karunakaran sendtokarunakaran at gmail.com
Tue Sep 27 07:52:01 CEST 2005


Hi Andrew,
while sending v2 trap you have to set trap oid. follow this code.

PDU pdu =new PDU();
pdu.setType(PDU.TRAP);
pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(MYOID
+ "0.4"));
This will work .


On 9/23/05, Andrew Chan <wingnin at gmail.com> wrote:
>
> Dear all,
> I can send v1 trap from my program, the pdu were created as follow
> PDUv1 pdu = new PDUv1();
> pdu.setType(PDU.V1TRAP);
> pdu.setGenericTrap(PDUv1.ENTERPRISE_SPECIFIC);
> pdu.setSpecificTrap(4);
> pdu.add(new VariableBinding(new OID(MYOID + ".1"), new Integer32(1)));



When I try to migrate the code to v2c, how should I create the PDU?
> PDU pdu = new PDU();
> pdu.setType(PDU.TRAP);
> pdu.add(new VariableBinding(SnmpConstants.snmpTrapEnterprise, new
> OID(MYOID
> + "0.4"));
> pdu.add(new VariableBinding(new OID(MYOID + ".1"), new Integer32(1)));
> However, I capture a invalid notification format error from some MIB
> Browser (from MG-Soft), can you help me to solve this problem? Thanks.
> AC
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>



More information about the SNMP4J mailing list