[SNMP4J] Notification filtering

Houghton, Jack SPAWAR jack.houghton at navy.mil
Thu Feb 9 19:21:21 CET 2006


Dear Matthias:
I believe substituting this code for the 2nd line should correct the
problem.
Best Regards,
Jack Houghton


    OID paramsIndexNext = (OID) paramsIndex.clone();
    paramsIndexNext.set( paramsIndexNext.size()-1,
                         paramsIndexNext.last()+1 );
    List profiles =
        snmpNotifyFilterProfileEntryModel.getRows(paramsIndex,
paramsIndexNext,
                                                  activeFilter);
-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of Matthias Wiesmann
Sent: Thursday, February 09, 2006 2:35 AM
To: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Notification filtering


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.9
7.105.115.116.46.97.99.46.106.112
in
org.snmp4j.agent.mo.DefaultMOMutableTableModel{org.snmp4j.agent.mo.Defau
ltMOMutableRow2PC:104.98.45.107.116.45.100.104.99.112.50.51.46.106.97.10
5.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 _______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org http://lists.agentpp.org/mailman/listinfo/snmp4j



More information about the SNMP4J mailing list