[SNMP4J] Sending SNMPV3 Notifications Containing Table Row

Frank Fock fock at agentpp.com
Fri Apr 1 23:45:51 CEST 2016


Hi Peter,

There is no such method to add a complete row to a PDU. 
For traps/notifications, it would be against the protocol design.
Traps and notifications should inform about changes but should
not transport (all) the data that changed. 
In a critical situation, the risk is too high that a big PDU could not
be created, send, received and processed properly. Therefore,
the concept of trap-directed-polling is used. Thus, you should
only send a single column that is most critical to know about.
The rest of the columns can then be requested by the
trap receiver if needed.

Best regards,
Frank


> On 01 Apr 2016, at 20:11, Peter S <peterkt2000 at yahoo.com> wrote:
> 
> Greetings,
> Thank you for the SNMP4J library.
> I understand with the SNMP protocol there is no concrete implementation of a Table or Row. These concepts are part of the SMI specification, not the protocol.
> 
> However, I was wondering if the SNMP4J Agent API provided a convenience method or API for sending an entire row or even a table of rows in an SNMP trap or notification. I am using the free version of SNMP4J agent, version 2.4.2.  I have functioning code for sending simple scalar notifications. My question concerns sending complex types, like table rows. If such a row can be containing in one UDP message, is there an easy way to just provide this row to the SNMP4J api. Something like the following:
> MOTable<...> table = moFactory.createTable(rootTableOID, indexDef, columns)... build table and rowsScopedPDU pdu = new ScopedPDU()List<VariableBinding> vb = new ArrayList ...vb.add(0, new VariableBinding(SnmpConstants.sysUpTime, sysUpTime));vb.add(1, new VariableBinding(SnmpConstants.snmpTrapOID, notificationRoot));vb.add(2, new VariableBinding(tableRootOID, table);..orvb.add(2, new VariableBinding(tableRootOID, a row in table)...pdu.addAll(vb);
> snmp.notify(pdu, target);
> 
> 
> Alternatively ...
> 
> If there is no such support for this functionality, my approach is to simply add multiple VariableBinding instances for each column instance value to a ScopedPDU instance. Would this be something like the following?
> ScopedPDU pdu = new ScopedPDU()List<VariableBinding> vb = new ArrayList ...vb.add(0, new VariableBinding(SnmpConstants.sysUpTime, sysUpTime));vb.add(1, new VariableBinding(SnmpConstants.snmpTrapOID, notificationRoot));
> ...for each column in a table rowvb.add(columnIndex, new VariableBinding(full columnOID, including instance number, value)pdu.addAll(vb);
> snmp.notify(pdu, target);
> Thank you in advance for your help!
> -Peter
> 
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j




More information about the SNMP4J mailing list