getBMXValues(report, schedules);
else
getSNMPValues(report, schedules);
}
private void getSNMPValues(MeasurementReport report, Set<MeasurementScheduleRequest> schedules) throws Exception {
SNMPSession snmpSession = getSNMPSession();
boolean snmpPresent = snmpSession.ping();
for (MeasurementScheduleRequest schedule : schedules) {
String metricName = schedule.getName();
if (metricName.equals(SERVER_BUILT_TRAIT)) {
MeasurementDataTrait trait = new MeasurementDataTrait(schedule, this.binaryInfo.getBuilt());
report.addData(trait);
} else if (metricName.equals("rhq_avail_ping_time")) {
if (availPingTime == -1)
continue; // Skip if we have no data
MeasurementDataNumeric num = new MeasurementDataNumeric(schedule, (double) availPingTime);
report.addData(num);
} else {
// Assume anything else is an SNMP metric.
if (!snmpPresent)
continue; // Skip this metric if no SNMP present
try {
//noinspection UnnecessaryLocalVariable
String mibName = metricName;
List<SNMPValue> snmpValues = snmpSession.getColumn(mibName);
if (snmpValues.isEmpty()) {
LOG.error("No values found for MIB name [" + mibName + "].");
continue;
}