in collector/snmp/src/main/java/org/apache/karaf/decanter/collector/snmp/SnmpPoller.java [168:209]
public void run() {
this.pdu.clear();
this.pdu.setType(PDU.GETNEXT);
if (!treeList) {
for (String oid : oids.split(",")) {
this.pdu.add(new VariableBinding(new OID(oid)));
}
} else {
TreeUtils treeUtils = new TreeUtils(snmp, new DefaultPDUFactory());
for (String oid : oids.split(",")) {
List events = treeUtils.getSubtree(target, new OID(oid));
for (Object event : events) {
TreeEvent treeEvent = (TreeEvent) event;
if (treeEvent == null) {
LOGGER.warn("SNMP event is null");
continue;
}
if (treeEvent.isError()) {
LOGGER.error("Error in SNMP event: {}", treeEvent.getErrorMessage());
continue;
}
VariableBinding[] variableBindings = treeEvent.getVariableBindings();
if (variableBindings == null || variableBindings.length == 0) {
continue;
}
for (VariableBinding variableBinding : variableBindings) {
if (variableBinding == null) {
continue;
}
this.pdu.add(variableBinding);
}
}
}
}
try {
snmp.send(pdu, target, null, this);
} catch (Exception e) {
LOGGER.warn("Can't send SNMP request", e);
}
}