[SNMP4J] Notification filtering
Frank Fock
fock at agentpp.com
Thu Feb 9 19:26:39 CET 2006
Hi Jack,
I just wanted to send the same code snippet ;-)
I know it is time for an update, but I need some
more time...
The ProxyForwarder (SNMP-PROXY-MIB and SNMP-COMMUNITY-MIB)
implementation is now ready for testing, but there are
also some other areas that need some work.
@Matthias: Thanks for pointing me to the DefaultMOTabeModel
typo. I have fixed that too.
Best regards,
Frank
Houghton, Jack SPAWAR wrote:
> 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
> _______________________________________________
> 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