[SNMP4J] Notification filtering

Matthias Wiesmann matthias.wiesmann at gmail.com
Thu Feb 9 11:34:48 CET 2006


Hello everybody,

I'm still fighting with notification filtering, it seems to me that
the first part of passesFilter does not work. I added some debugging
code.

public boolean passesFilter(OID paramsIndex, OID notificationID,
                              VariableBinding[] vbs) {
    MOTableRowFilter activeFilter =
        new RowStatus.ActiveRowsFilter(idxSnmpNotifyFilterProfileRowStatus);
    List profiles =
        snmpNotifyFilterProfileEntryModel.getRows(paramsIndex, paramsIndex,
                                                  activeFilter);
    if (profiles.size() == 0) {
	final OctetString params = new
OctetString(MOTableIndex.getBytes(paramsIndex)) ;
	logger.info("found no matching profile for
"+paramsIndex+"("+params+") "+notificationID+" in
"+snmpNotifyFilterProfileEntryModel) ;
      // no profile -> passes filter
	
      return true;
    }

And I managed to get the following output:

found not matching profile for
104.98.45.107.116.45.100.104.99.112.50.51.46.106.97.105.115.116.46.97.99.46.106.112(hb-kt-dhcp23.jaist.ac.jp)
1.3.6.1.4.1.999.1.2.1.104.98.45.107.116.45.100.104.99.112.50.51.46.106.97.105.115.116.46.97.99.46.106.112
in org.snmp4j.agent.mo.DefaultMOMutableTableModel{org.snmp4j.agent.mo.DefaultMOMutableRow2PC:104.98.45.107.116.45.100.104.99.112.50.51.46.106.97.105.115.116.46.97.99.46.106.112
[hb-kt-dhcp23.jaist.ac.jp, 3, 1]}
Sent notification TRAP[requestID=1497844182, errorStatus=Success(0),
errorIndex=0, VBS[1.3.6.1.2.1.1.3.0 = 0:32:30.31; 1.3.

I think the problem is related to the fact that the filter relies on
DefaultMOMutableTableModel.getView() that in turns relies on
SortedMap.subMap that returns and exclusive range from the Javadoc:

"Returns a view of the portion of this sorted map whose keys range
from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey
are equal, the returned sorted map is empty.)"

This contradicts the javadoc for getRows that specifies that the lower
bound should be included.

As the requested notification range is OID-OID, the subMap returns an
empty range, that results in no match.

Best regards

Matthias Wiesmann



More information about the SNMP4J mailing list