diff --git a/opennms-services/src/main/java/org/opennms/netmgt/snmpinterfacepoller/SnmpPollInterfaceMonitor.java b/opennms-services/src/main/java/org/opennms/netmgt/snmpinterfacepoller/SnmpPollInterfaceMonitor.java index 96c02e4..46327b5 100644 --- a/opennms-services/src/main/java/org/opennms/netmgt/snmpinterfacepoller/SnmpPollInterfaceMonitor.java +++ b/opennms-services/src/main/java/org/opennms/netmgt/snmpinterfacepoller/SnmpPollInterfaceMonitor.java @@ -105,15 +105,22 @@ public class SnmpPollInterfaceMonitor { int i=0; for(SnmpValue result : results) { if (result != null) { - log().debug("Snmp Value is "+ result.toInt() + " for oid: " + oids[i]); + int intResult; + if(result.getType() == SnmpValue.SNMP_NO_SUCH_INSTANCE) { + intResult = 0; + log().debug("Device returned noSuchInstance error. Working around this by pretending the interface is down for oid: " + oids[i]); + } else { + intResult = result.toInt(); + } + log().debug("Snmp Value is "+ intResult + " for oid: " + oids[i]); if (i< mifaces.size()) { SnmpMinimalPollInterface miface = mifaces.get(i); miface.setStatus(PollStatus.up()); - miface.setAdminstatus(result.toInt()); + miface.setAdminstatus(intResult); } else { SnmpMinimalPollInterface miface = mifaces.get(i-mifaces.size()); miface.setStatus(PollStatus.up()); - miface.setOperstatus(result.toInt()); + miface.setOperstatus(intResult); } } else { log().error("Snmp Value is null for oid: " + oids[i]);