return address.getInetAddress();
}
public LinkedList getNextMIBValue(String OIDString, SNMPType valueType, String scope) throws SNMPException, SNMPScopeException {
PDU pdu;
ResponseEvent response;
String nextOID;
Variable nextVariable;
Object nextValue;
LinkedList returnPair;
try {
pdu = new PDU();
pdu.add(new VariableBinding(new OID(OIDString)));
logger.debug("SNMP GETNEXT of " + address.getHostAddress() + " :: " + OIDString);
response = snmp.getNext(pdu, target);
if ( response.getError() != null ) {
logger.error("Error while issuing SNMP GETNEXT for " +
address.getHostAddress() + " :: " + OIDString);
throw new SNMPException("Error while issuing SNMP GETNEXT for " +
address.getHostAddress() + " :: " + OIDString, response.getError());
}
if ( response.getResponse() == null ) {
logger.warn("SNMP GET timeout for " + address.getHostAddress() + " :: " + OIDString);
throw (new SNMPException("SNMP GETNEXT timeout for " + address.getHostAddress() + " :: " + OIDString));
}
returnPair = new LinkedList();
nextOID = response.getResponse().get(0).getOid().toString();
// Scope check
if ( scope != null && ! nextOID.matches(scope + ".*")) {
logger.debug("OID " + nextOID + " not under scope " + scope + " in MIB for SNMP GETNEXT on " + address.getHostAddress() + " :: " + OIDString);
throw new SNMPScopeException("OID " + nextOID + " not under scope " + scope + " in MIB on SNMP GETNEXT for " + address.getHostAddress() + " :: " + OIDString);
}
returnPair.add(nextOID);
nextVariable = response.getResponse().get(0).getVariable();
if ( nextVariable instanceof org.snmp4j.smi.Null ) {
logger.warn("OID not found in MIB for SNMP GETNEXT on " + address.getHostAddress() + " :: " + OIDString);
throw new SNMPException("OID not found in MIB for SNMP GETNEXT on " + address.getHostAddress() + " :: " + OIDString);
}