[SNMP4J] Re: Doubt about NOTIFICATION-TYPE

Frank Fock Frank.Fock at t-online.de
Mon Jul 12 22:12:04 CEST 2004


Hello Carlos,

the mailing list was up, although the web interface was down unfortunately.
It is up again now ;-). Thanks for the tip!

Regarding your question: Of course it is possible to send SNMPv2c/v3
notifications of any type with SNMP4J. A contribution to the clean design
was the lack of getter/setter methods for the two required variable bindings
of notifications: sysUpTime.0 and snmpTrapOID.0. These two variable
bindings have to be added by the API user when the notification PDU
is assembled. An example for your notification ID would be:

PDU notification = new PDU();
notification.add(new VariableBinding(SnmpConstants.sysUpTime,
                        new TimeTicks(0)));
notification.add(new VariableBinding(SnmpConstants.snmpTrapOID,
                        new OID("1.3.6.1.3.1.193.100.1.1.1.2.1.1")));
// add the VBs from the NOTIFICATION-TYPE OBJECTS clause definition here
notification.add(new VariableBinding(...));
...

Hope this helps.

Best regards,
Frank

Carlos Andres gonzalez wrote:

> Hello,
>
> My name is Carlos Andrés and I was thinking to use the snmp4j but I 
> have a big doubt. I've tried to write this doubt in your mailing list 
> but actually is down. How can I generate an alarma like this?
>
> alarmNew NOTIFICATION-TYPE
>         OBJECTS {
>                 alarmSeqNumber,
>                 alarmPerceivedSeverity,
>                 alarmTimeStamp,
>                 alarmOrigin,
>                 alarmCause,
>                 alarmAffectedElements,
>                 alarmSpecificProblem,
>                 alarmRemedy}
>         STATUS current
>         DESCRIPTION
>                 "This notification is sent when an Alarm is raised.
>                 ."
>  -- 1.3.6.1.4.1.193.100.1.1.1.2.1.1 --  ::= { alarmNotificationPrefix 1 }
>
>
>   I have created a PDU object that I send with a SNMP object. In this 
> PDU object I have been adding the alarmSeqNumber, 
> alarmPerceivedSeverity, etc like variable bindings with their OIDs. 
> But the notification-type has his own OID 
> (1.3.6.1.3.1.193.100.1.1.1.2.1.1) and I don't find any place to put 
> this OID.
>
>   How can I send this notification-type? Can I do it with this library?
>
>   Thanks in advance,
>   Carlos Andrés.
>





More information about the SNMP4J mailing list