[SNMP4J] Question regarding SNMPv2c Notification using SNMP4J

Frank Fock fock at agentpp.com
Sun Jan 8 10:11:32 CET 2006


Hello Vinod,

SNMPv2c/v3 traps (i.e. notifications) do not have an explicit
notification ID. Instead die PDU must have always two variable
bindings, which are

1. sysUpTime.0
2. snmpTrapOID.0

in the order given above. Any variable binding specified in the
NOTIFICATION-TYPE construct has then to follow at position
3 and following.

Best regards,
Frank

Vinod Kumar wrote:

>Hello,
>
>You could do a small help to me.
>I was sending a SNMP v2c notification using SNMP4J. But I am surprised to
>see there is nowhere I need to specify the OID of the notification. For
>example, in the example given below, the OID of the notification is "ems 27"
>
>
>endOfResponseNotification  NOTIFICATION-TYPE
>         OBJECTS {
>                            endOfMessageString
>                         }
>        STATUS current
>        DESCRIPTION
>                        "This specific notification is sent when the agent
>finishes sending all notifications of a particular type"
>        ::= { ems 27}
>
>The associated code to send the notification using SNMP4J is given below
>where I dont set the value "ems 27" anywhere but still my SNMP manager
>receives the trap. Could you please let me know how the manager can identify
>the notification OID, in this case "ems 27"?
>
>Suppose, the OID for the object endOfMessageString is
>1.3.6.1.4.1.99.12.19.1.1.1.1.90.5
>
>-----------------------------------------------------------------------------------------------------------------------------------------------
>  PDU pdu = new PDU();
>  String stringValue = "End of Message";
>  VariableBinding varbind = new VariableBinding(new OID("
>1.3.6.1.4.1.99.12.19.1.1.1.1.90.5"),new OctetString(stringValue));
>  pdu.add(varbind);
>  pdu.setType(PDU.NOTIFICATION);
>  Address addr = new UdpAddress(InetAddress.getByName("machine01"), 162);
>  target.setAddress(addr);
>  target.setRetries(2);
>  target.setTimeout(1500);
>  target.setVersion(SnmpConstants.version2c);
>
>  ResponseEvent resp= snmp.send(pdu, target);
>
>------------------------------------------------------------------------------------
>
>Any help in this respect is highly appreciated.
>Thanks
>Best Regards
>Vinod.
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>
>  
>


-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list