[SNMP4J] TreeUtils detecting issues with getSubtree results

Mackay, Scott scott.mackay at progeny.net
Tue Aug 3 15:36:42 CEST 2010


A sanity check, in case anyone has processed the error results before...
It looks like the List of TreeEvents holds the information.
for each TreeEvent entry you can do a .isError().  I think the detection would be as follows:

          for (int i = 0; i < results.size(); i++) {
            TreeEvent tresult = (TreeEvent) results.get(i);
            if (tresult.isError()==true) {
                 if (tresult.getStatus()==TreeEvent.STATUS_REPORT){
                    VariableBinding[] bindings=tresult.getVariableBindings();
                    for (VariableBinding bind:bindings) {
                        if (bind.getOid().equals(SnmpConstants.usmStatsNotInTimeWindows)==true) {
                            result.badTimeWindow=true;
                            break;
                        }

                    }

                }
            }
Does that seem the right place to get an error status like the not in time window?


-Scott


-----Original Message-----
From: snmp4j-bounces at agentpp.org on behalf of Mackay, Scott
Sent: Mon 8/2/2010 7:17 PM
To: snmp4j at agentpp.org
Subject: [SNMP4J] TreeUtils detecting issues with getSubtree results
 

I had a question about detecting error conditions while performing a TreeUtils getSubtree() method.

Is there a standard result processing layout for detecting issues with the results?

Instead of hunting and pecking for each of the possible error codes, I was wondering if anyone has a template method which takes the getSubtree results and translates issues to exceptions or at least just have stub code with all the possible error conditions laid out.

-Scott
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j





More information about the SNMP4J mailing list