Work on nextract naming.

This commit is contained in:
Mark Nellemann 2021-03-25 16:46:04 +01:00
parent da26d25c2c
commit c324e24014
16 changed files with 709 additions and 259 deletions

View file

@ -1,3 +1,3 @@
id = hmci
group = biz.nellemann.hmci
version = 1.1.6
version = 1.2.1

View file

@ -132,58 +132,120 @@ class InfluxClient {
return;
}
getSystemMemory(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemDetails(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemProcessor(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemPhysicalProcessorPool(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemSharedProcessorPools(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemSharedAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemFiberChannelAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemVirtualEthernetAdapters(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemViosMemory(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemMemory(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemViosDetails(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosProcessor(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemViosMemory(system, timestamp).forEach( it -> batchPoints.point(it) );
getSystemViosNetworkLpars(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosNetworkGenericAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosNetworkSharedAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosNetworkVirtualAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosStorageLpars(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosFiberChannelAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosStoragePhysicalAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemViosStorageVirtualAdapters(system, timestamp).forEach(it -> batchPoints.point(it) );
}
private static List<Point> getSystemMemory(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "SystemMemory");
// TODO: server_details
private static List<Point> getSystemDetails(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getDetails();
return processMeasurementMap(metrics, timestamp, "server_details");
}
private static List<Point> getSystemProcessor(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getProcessorMetrics();
return processMeasurementMap(metrics, timestamp, "SystemProcessor");
return processMeasurementMap(metrics, timestamp, "server_processor");
}
private static List<Point> getSystemPhysicalProcessorPool (ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getPhysicalProcessorPool();
return processMeasurementMap(metrics, timestamp, "server_physicalProcessorPool");
}
private static List<Point> getSystemSharedProcessorPools(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSharedProcessorPools();
return processMeasurementMap(metrics, timestamp, "SystemSharedProcessorPool");
return processMeasurementMap(metrics, timestamp, "server_sharedProcessorPool");
}
private static List<Point> getSystemSharedAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSystemSharedAdapters();
return processMeasurementMap(metrics, timestamp, "SystemSharedAdapters");
private static List<Point> getSystemMemory(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "server_memory");
}
private static List<Point> getSystemFiberChannelAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSystemFiberChannelAdapters();
return processMeasurementMap(metrics, timestamp, "SystemFiberChannelAdapters");
}
private static List<Point> getSystemVirtualEthernetAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getSystemVirtualEthernetAdapters();
return processMeasurementMap(metrics, timestamp, "SystemVirtualEthernetAdapters");
}
private static List<Point> getSystemViosMemory(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "SystemViosMemory");
private static List<Point> getSystemViosDetails(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosDetails();
return processMeasurementMap(metrics, timestamp, "vios_details");
}
private static List<Point> getSystemViosProcessor(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosProcessorMetrics();
return processMeasurementMap(metrics, timestamp, "SystemViosProcessor");
return processMeasurementMap(metrics, timestamp, "vios_processor");
}
private static List<Point> getSystemViosMemory(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "vios_memory");
}
private static List<Point> getSystemViosNetworkLpars(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosNetworkLpars();
return processMeasurementMap(metrics, timestamp, "vios_network_lpars");
}
private static List<Point> getSystemViosNetworkVirtualAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosNetworkVirtualAdapters();
return processMeasurementMap(metrics, timestamp, "vios_network_virtual");
}
private static List<Point> getSystemViosNetworkSharedAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosNetworkSharedAdapters();
return processMeasurementMap(metrics, timestamp, "vios_network_shared");
}
private static List<Point> getSystemViosNetworkGenericAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosNetworkGenericAdapters();
return processMeasurementMap(metrics, timestamp, "vios_network_generic");
}
private static List<Point> getSystemViosStorageLpars(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosStorageLpars();
return processMeasurementMap(metrics, timestamp, "vios_storage_lpars");
}
private static List<Point> getSystemViosFiberChannelAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosStorageFiberChannelAdapters();
return processMeasurementMap(metrics, timestamp, "vios_storage_FC");
}
/*
private static List<Point> getSystemViosSharedStoragePools(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosStorageSharedStoragePools();
return processMeasurementMap(metrics, timestamp, "vios_storage_SSP");
}*/
private static List<Point> getSystemViosStoragePhysicalAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosStoragePhysicalAdapters();
return processMeasurementMap(metrics, timestamp, "vios_storage_physical");
}
private static List<Point> getSystemViosStorageVirtualAdapters(ManagedSystem system, Instant timestamp) {
List<Measurement> metrics = system.getViosStorageVirtualAdapters();
return processMeasurementMap(metrics, timestamp, "vios_storage_virtual");
}
/*
Logical Partitions
@ -202,39 +264,44 @@ class InfluxClient {
return;
}
getPartitionAffinityScore(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionDetails(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionMemory(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionProcessor(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionVirtualEthernetAdapter(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionVirtualFiberChannelAdapter(partition, timestamp).forEach( it -> batchPoints.point(it));
getPartitionNetworkVirtual(partition, timestamp).forEach(it -> batchPoints.point(it));
getPartitionStorageVirtualGeneric(partition, timestamp).forEach(it -> batchPoints.point(it));
getPartitionStorageVirtualFibreChannel(partition, timestamp).forEach(it -> batchPoints.point(it));
}
private static List<Point> getPartitionAffinityScore(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getAffinityScore();
return processMeasurementMap(metrics, timestamp, "PartitionAffinityScore");
}
private static List<Point> getPartitionMemory(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "PartitionMemory");
private static List<Point> getPartitionDetails(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getDetails();
return processMeasurementMap(metrics, timestamp, "lpar_details");
}
private static List<Point> getPartitionProcessor(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getProcessorMetrics();
return processMeasurementMap(metrics, timestamp, "PartitionProcessor");
return processMeasurementMap(metrics, timestamp, "lpar_processor");
}
private static List<Point> getPartitionVirtualEthernetAdapter(LogicalPartition partition, Instant timestamp) {
private static List<Point> getPartitionMemory(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getMemoryMetrics();
return processMeasurementMap(metrics, timestamp, "lpar_memory");
}
private static List<Point> getPartitionNetworkVirtual(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getVirtualEthernetAdapterMetrics();
return processMeasurementMap(metrics, timestamp, "PartitionVirtualEthernetAdapters");
return processMeasurementMap(metrics, timestamp, "lpar_network_virtual");
}
private static List<Point> getPartitionVirtualFiberChannelAdapter(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getVirtualFiberChannelAdaptersMetrics();
return processMeasurementMap(metrics, timestamp, "PartitionVirtualFiberChannelAdapters");
private static List<Point> getPartitionStorageVirtualGeneric(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getVirtualGenericAdapterMetrics();
return processMeasurementMap(metrics, timestamp, "lpar_storage_generic");
}
private static List<Point> getPartitionStorageVirtualFibreChannel(LogicalPartition partition, Instant timestamp) {
List<Measurement> metrics = partition.getVirtualFibreChannelAdapterMetrics();
return processMeasurementMap(metrics, timestamp, "lpar_storage_virtual");
}
/*
@ -262,12 +329,12 @@ class InfluxClient {
private static List<Point> getSystemEnergyPower(SystemEnergy system, Instant timestamp) {
List<Measurement> metrics = system.getPowerMetrics();
return processMeasurementMap(metrics, timestamp, "SystemEnergyPower");
return processMeasurementMap(metrics, timestamp, "server_energy_power");
}
private static List<Point> getSystemEnergyTemperature(SystemEnergy system, Instant timestamp) {
List<Measurement> metrics = system.getThermalMetrics();
return processMeasurementMap(metrics, timestamp, "SystemEnergyThermal");
return processMeasurementMap(metrics, timestamp, "server_energy_thermal");
}
@ -280,23 +347,32 @@ class InfluxClient {
List<Point> listOfPoints = new ArrayList<>();
measurements.forEach( m -> {
Point.Builder builder = Point.measurement(measurement)
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS);
// Iterate fields
m.fields.forEach((fieldName, fieldValue) -> {
log.trace("processMeasurementMap() " + measurement + " - fieldName: " + fieldName + ", fieldValue: " + fieldValue);
if(fieldValue instanceof Number) {
Number num = (Number) fieldValue;
builder.addField(fieldName, num);
} else if(fieldValue instanceof Boolean) {
Boolean bol = (Boolean) fieldValue;
builder.addField(fieldName, bol);
} else {
String str = (String) fieldValue;
builder.addField(fieldName, str);
}
});
Point.Builder builder = Point.measurement(measurement)
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS)
.tag("name", fieldName)
.addField("value", fieldValue);
// For each field, we add all tags
// Iterate tags
m.tags.forEach((tagName, tagValue) -> {
builder.tag(tagName, tagValue);
log.trace("processMeasurementMap() " + measurement + " - tagName: " + tagName + ", tagValue: " + tagValue);
builder.tag(tagName, tagValue);
});
listOfPoints.add(builder.build());
});
});

View file

@ -47,34 +47,40 @@ class LogicalPartition extends MetaSystem {
}
List<Measurement> getAffinityScore() {
// LPAR Details
List<Measurement> getDetails() {
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
log.trace("getAffinityScore() - tags: " + tagsMap.toString());
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
log.trace("getDetails() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("id", metrics.systemUtil.sample.lparsUtil.id);
fieldsMap.put("type", metrics.systemUtil.sample.lparsUtil.type);
fieldsMap.put("state", metrics.systemUtil.sample.lparsUtil.state);
fieldsMap.put("osType", metrics.systemUtil.sample.lparsUtil.osType);
fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore);
log.trace("getAffinityScore() - fields: " + fieldsMap.toString());
log.trace("getDetails() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
// LPAR Memory
List<Measurement> getMemoryMetrics() {
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
log.trace("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("logicalMem", metrics.systemUtil.sample.lparsUtil.memory.logicalMem);
fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem);
log.trace("getMemoryMetrics() - fields: " + fieldsMap.toString());
@ -84,27 +90,31 @@ class LogicalPartition extends MetaSystem {
}
// LPAR Processor
List<Measurement> getProcessorMetrics() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
log.trace("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits);
fieldsMap.put("entitledProcUnits", metrics.systemUtil.sample.lparsUtil.processor.entitledProcUnits);
fieldsMap.put("donatedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.donatedProcUnits);
fieldsMap.put("idleProcUnits", metrics.systemUtil.sample.lparsUtil.processor.idleProcUnits);
fieldsMap.put("maxProcUnits", metrics.systemUtil.sample.lparsUtil.processor.maxProcUnits);
fieldsMap.put("maxVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.maxVirtualProcessors);
fieldsMap.put("currentVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.currentVirtualProcessors);
//fieldsMap.donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(),
fieldsMap.put("entitledProcUnits", metrics.systemUtil.sample.lparsUtil.processor.entitledProcUnits);
//fieldsMap.idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(),
//fieldsMap.maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(),
fieldsMap.put("utilizedCappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedCappedProcUnits);
fieldsMap.put("utilizedUncappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedUncappedProcUnits);
fieldsMap.put("timePerInstructionExecution", metrics.systemUtil.sample.lparsUtil.processor.timeSpentWaitingForDispatch);
fieldsMap.put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution);
fieldsMap.put("mode", metrics.systemUtil.sample.lparsUtil.processor.mode);
fieldsMap.put("weight", metrics.systemUtil.sample.lparsUtil.processor.weight);
fieldsMap.put("poolId", metrics.systemUtil.sample.lparsUtil.processor.poolId);
log.trace("getProcessorMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
@ -112,6 +122,7 @@ class LogicalPartition extends MetaSystem {
}
// LPAR Network - Virtual
List<Measurement> getVirtualEthernetAdapterMetrics() {
List<Measurement> list = new ArrayList<>();
@ -119,19 +130,29 @@ class LogicalPartition extends MetaSystem {
metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("sea", adapter.sharedEthernetAdapterId);
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
tagsMap.put("location", adapter.physicalLocation);
tagsMap.put("viosId", adapter.viosId.toString());
tagsMap.put("vlanId", adapter.vlanId.toString());
tagsMap.put("vswitchId", adapter.vswitchId.toString());
log.trace("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("droppedPackets", adapter.droppedPackets);
fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets);
fieldsMap.put("isPortVlanId", adapter.isPortVlanId);
fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes);
fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets);
fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes);
fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
fieldsMap.put("receivedPackets", adapter.receivedPackets);
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("sentPackets", adapter.sentPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes);
fieldsMap.put("sharedEthernetAdapterId", adapter.sharedEthernetAdapterId);
log.trace("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
@ -141,23 +162,27 @@ class LogicalPartition extends MetaSystem {
}
List<Measurement> getVirtualFiberChannelAdaptersMetrics() {
// LPAR Storage - Virtual Generic
List<Measurement> getVirtualGenericAdapterMetrics() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> {
metrics.systemUtil.sample.lparsUtil.storage.genericVirtualAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
tagsMap.put("viosId", adapter.viosId.toString());
tagsMap.put("wwpn", adapter.wwpn);
log.trace("getVirtualFiberChannelAdaptersMetrics() - tags: " + tagsMap.toString());
tagsMap.put("location", adapter.physicalLocation);
tagsMap.put("id", adapter.id);
log.trace("getVirtualGenericAdapterMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("transmittedBytes", adapter.transmittedBytes.get(0));
fieldsMap.put("writeBytes", adapter.writeBytes.get(0));
fieldsMap.put("readBytes", adapter.readBytes.get(0));
log.trace("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("type", adapter.type);
log.trace("getVirtualGenericAdapterMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
@ -165,4 +190,34 @@ class LogicalPartition extends MetaSystem {
return list;
}
// LPAR Storage - Virtual FC
List<Measurement> getVirtualFibreChannelAdapterMetrics() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", system.name);
tagsMap.put("lparname", name);
tagsMap.put("viosId", adapter.viosId.toString());
tagsMap.put("location", adapter.physicalLocation);
log.trace("getVirtualFibreChannelAdapterMetrics() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
//fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
//fieldsMap.put("wwpn", adapter.wwpn);
//fieldsMap.put("wwpn2", adapter.wwpn2);
log.trace("getVirtualFibreChannelAdapterMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
return list;
}
}

View file

@ -52,36 +52,62 @@ class ManagedSystem extends MetaSystem {
}
List<Measurement> getDetails() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
log.trace("getDetails() - tags: " + tagsMap.toString());
Map<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("mtm", String.format("%s-%s %s", type, model, serialNumber));
fieldsMap.put("APIversion", metrics.systemUtil.utilInfo.version);
fieldsMap.put("metric", metrics.systemUtil.utilInfo.metricType);
fieldsMap.put("frequency", metrics.systemUtil.utilInfo.frequency);
fieldsMap.put("nextract", "HMCi");
fieldsMap.put("name", name);
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.systemFirmwareUtil.utilizedProcUnits);
fieldsMap.put("assignedMem", metrics.systemUtil.sample.systemFirmwareUtil.assignedMem);
log.trace("getDetails() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
// Memory
List<Measurement> getMemoryMetrics() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("servername", name);
log.trace("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("totalMem", metrics.systemUtil.sample.serverUtil.memory.totalMem);
fieldsMap.put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem);
fieldsMap.put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem);
fieldsMap.put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars);
fieldsMap.put("virtualPersistentMem", metrics.systemUtil.sample.serverUtil.memory.virtualPersistentMem);
log.trace("getMemoryMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
// Processor
List<Measurement> getProcessorMetrics() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("servername", name);
log.trace("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("totalProcUnits", metrics.systemUtil.sample.serverUtil.processor.totalProcUnits);
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits);
fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits);
@ -92,20 +118,24 @@ class ManagedSystem extends MetaSystem {
return list;
}
// Shared ProcessorPools
List<Measurement> getSharedProcessorPools() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> {
metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("pool", adapter.name);
tagsMap.put("servername", name);
tagsMap.put("pool", sharedProcessorPool.id);
tagsMap.put("poolname", sharedProcessorPool.name);
log.trace("getSharedProcessorPools() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("assignedProcUnits", adapter.assignedProcUnits);
fieldsMap.put("availableProcUnits", adapter.availableProcUnits);
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("assignedProcUnits", sharedProcessorPool.assignedProcUnits);
fieldsMap.put("availableProcUnits", sharedProcessorPool.availableProcUnits);
fieldsMap.put("utilizedProcUnits", sharedProcessorPool.utilizedProcUnits);
fieldsMap.put("borrowedProcUnits", sharedProcessorPool.borrowedProcUnits);
fieldsMap.put("configuredProcUnits", sharedProcessorPool.configuredProcUnits);
log.trace("getSharedProcessorPools() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
@ -115,18 +145,65 @@ class ManagedSystem extends MetaSystem {
}
// VIOs Memory
// Physical ProcessorPool
List<Measurement> getPhysicalProcessorPool() {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
log.trace("getPhysicalProcessorPool() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("assignedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.assignedProcUnits);
fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.availableProcUnits);
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.utilizedProcUnits);
fieldsMap.put("configuredProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.configuredProcUnits);
fieldsMap.put("borrowedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.borrowedProcUnits);
log.trace("getPhysicalProcessorPool() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
return list;
}
// VIO Details
List<Measurement> getViosDetails() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
log.trace("getViosDetails() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("viosid", vios.id);
fieldsMap.put("viosstate", vios.state);
fieldsMap.put("viosname", vios.name);
fieldsMap.put("affinityScore", vios.affinityScore);
log.trace("getViosDetails() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
return list;
}
// VIO Memory
List<Measurement> getViosMemoryMetrics() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
log.trace("getViosMemoryMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
Number assignedMem = getNumberMetricObject(vios.memory.assignedMem);
Number utilizedMem = getNumberMetricObject(vios.memory.utilizedMem);
if(assignedMem != null) {
@ -137,7 +214,7 @@ class ManagedSystem extends MetaSystem {
}
if(assignedMem != null && utilizedMem != null) {
Number usedMemPct = (utilizedMem.intValue() * 100 ) / assignedMem.intValue();
fieldsMap.put("utilizedMemPct", usedMemPct.floatValue());
fieldsMap.put("utilizedPct", usedMemPct.floatValue());
}
log.trace("getViosMemoryMetrics() - fields: " + fieldsMap.toString());
@ -148,26 +225,30 @@ class ManagedSystem extends MetaSystem {
}
// VIOs Processor
// VIO Processor
List<Measurement> getViosProcessorMetrics() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
log.trace("getViosProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("utilizedProcUnits", vios.processor.utilizedProcUnits);
fieldsMap.put("maxVirtualProcessors", vios.processor.maxVirtualProcessors);
fieldsMap.put("currentVirtualProcessors", vios.processor.currentVirtualProcessors);
fieldsMap.put("entitledProcUnits", vios.processor.entitledProcUnits);
fieldsMap.put("utilizedCappedProcUnits", vios.processor.utilizedCappedProcUnits);
fieldsMap.put("utilizedUncappedProcUnits", vios.processor.utilizedUncappedProcUnits);
fieldsMap.put("timePerInstructionExecution", vios.processor.timeSpentWaitingForDispatch);
fieldsMap.put("currentVirtualProcessors", vios.processor.currentVirtualProcessors);
fieldsMap.put("maxVirtualProcessors", vios.processor.maxVirtualProcessors);
fieldsMap.put("maxProcUnits", vios.processor.maxProcUnits);
fieldsMap.put("entitledProcUnits", vios.processor.entitledProcUnits);
fieldsMap.put("donatedProcUnits", vios.processor.donatedProcUnits);
fieldsMap.put("idleProcUnits", vios.processor.idleProcUnits);
fieldsMap.put("timeSpentWaitingForDispatch", vios.processor.timePerInstructionExecution);
fieldsMap.put("timePerInstructionExecution", vios.processor.timeSpentWaitingForDispatch);
fieldsMap.put("weight", vios.processor.weight);
log.trace("getViosProcessorMetrics() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
@ -177,8 +258,30 @@ class ManagedSystem extends MetaSystem {
}
// VIOs
List<Measurement> getSystemSharedAdapters() {
// VIOs - Network
List<Measurement> getViosNetworkLpars() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
log.trace("getViosNetworkLpars() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("clientlpars", vios.network.clientLpars.size());
log.trace("getViosNetworkLpars() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
return list;
}
// VIO Network - Shared
List<Measurement> getViosNetworkSharedAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
@ -186,48 +289,23 @@ class ManagedSystem extends MetaSystem {
vios.network.sharedAdapters.forEach(adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("type", adapter.type);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.trace("getSystemSharedAdapters() - tags: " + tagsMap.toString());
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
//tagsMap.put("id", adapter.id);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosNetworkSharedAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("id", adapter.id);
fieldsMap.put("type", adapter.type);
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("sentPackets", adapter.sentPackets);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
fieldsMap.put("receivedPackets", adapter.receivedPackets);
fieldsMap.put("droppedPackets", adapter.droppedPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
log.trace("getSystemSharedAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
// VIOs
List<Measurement> getSystemFiberChannelAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
log.trace("getSystemFiberChannelAdapters() - VIOS: " + vios.name);
vios.storage.fiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("id", adapter.id);
tagsMap.put("system", name);
tagsMap.put("wwpn", adapter.wwpn);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.trace("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
log.trace("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString());
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosNetworkSharedAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
@ -238,73 +316,8 @@ class ManagedSystem extends MetaSystem {
}
// VIOs
/*
List<Measurement> getSystemGenericPhysicalAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
vios.storage.genericPhysicalAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("id", adapter.id);
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.trace("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
log.trace("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
*/
// VIOs
/*
List<Measurement> getSystemGenericVirtualAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
vios.storage.genericVirtualAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
tagsMap.put("id", adapter.id);
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.trace("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
log.trace("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
*/
// VIOs
List<Measurement> getSystemVirtualEthernetAdapters() {
// VIO Network - Virtual
List<Measurement> getViosNetworkVirtualAdapters() {
List<Measurement> list = new ArrayList<>();
@ -313,15 +326,29 @@ class ManagedSystem extends MetaSystem {
vios.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.trace("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
tagsMap.put("vlanid", String.valueOf(adapter.vlanId));
tagsMap.put("vswitchid", String.valueOf(adapter.vswitchId));
tagsMap.put("systemname", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosNetworkVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("sentBytes", adapter.sentBytes);
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("droppedPackets", adapter.droppedPackets);
fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets);
fieldsMap.put("isPortVlanId", adapter.isPortVlanId);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
log.trace("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());
fieldsMap.put("receivedPackets", adapter.receivedPackets);
fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes);
fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets);
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("sentPackets", adapter.sentPackets);
fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes);
fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosNetworkVirtualAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
@ -331,4 +358,193 @@ class ManagedSystem extends MetaSystem {
return list;
}
// VIO Network - Generic
List<Measurement> getViosNetworkGenericAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
vios.network.genericAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("id", adapter.id);
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosNetworkGenericAdapters() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("sentPackets", adapter.sentPackets);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
fieldsMap.put("receivedPackets", adapter.receivedPackets);
fieldsMap.put("droppedPackets", adapter.droppedPackets);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
log.trace("getViosNetworkGenericAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
// VIOs - Storage
List<Measurement> getViosStorageLpars() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
log.trace("getViosStorageLpars() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("clientlpars", vios.storage.clientLpars.size());
log.trace("getViosStorageLpars() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
return list;
}
// VIO Storage FC
List<Measurement> getViosStorageFiberChannelAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
log.trace("getViosStorageFiberChannelAdapters() - VIOS: " + vios.name);
vios.storage.fiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosStorageFiberChannelAdapters() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("id", adapter.id);
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStorageFiberChannelAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
// VIO Storage SSP TODO
List<Measurement> getViosStorageSharedStoragePools() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
log.trace("getViosStorageSharedStoragePools() - VIOS: " + vios.name);
vios.storage.fiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("id", adapter.id);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosStorageSharedStoragePools() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStorageSharedStoragePools() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
// VIO Storage - Physical
List<Measurement> getViosStoragePhysicalAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
log.trace("getViosStoragePhysicalAdapters() - VIOS: " + vios.name);
vios.storage.genericPhysicalAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("id", adapter.id);
tagsMap.put("location", adapter.physicalLocation);
log.trace("getViosStoragePhysicalAdapters() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStoragePhysicalAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
// VIO Storage - Virtual
List<Measurement> getViosStorageVirtualAdapters() {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
log.trace("getViosStorageVirtualAdapters() - VIOS: " + vios.name);
vios.storage.genericVirtualAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("servername", name);
tagsMap.put("viosname", vios.name);
tagsMap.put("location", adapter.physicalLocation);
tagsMap.put("id", adapter.id);
log.trace("getViosStorageVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("numOfReads", adapter.numOfReads);
fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type);
fieldsMap.put("physicalLocation", adapter.physicalLocation);
log.trace("getViosStorageVirtualAdapters() - fields: " + fieldsMap.toString());
list.add(new Measurement(tagsMap, fieldsMap));
});
});
return list;
}
}

View file

@ -20,9 +20,9 @@ import java.util.Map;
public class Measurement {
final Map<String, String> tags;
final Map<String, Number> fields;
final Map<String, Object> fields;
Measurement(Map<String, String> tags, Map<String, Number> fields) {
Measurement(Map<String, String> tags, Map<String, Object> fields) {
this.tags = tags;
this.fields = fields;
}

View file

@ -47,10 +47,10 @@ class SystemEnergy extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("servername", system.name);
log.trace("getPowerMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
fieldsMap.put("powerReading", metrics.systemUtil.sample.energyUtil.powerUtil.powerReading);
log.trace("getPowerMetrics() - fields: " + fieldsMap.toString());
@ -64,10 +64,10 @@ class SystemEnergy extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("servername", system.name);
log.trace("getThermalMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures) {
fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading);

View file

@ -1,5 +1,7 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
import java.util.ArrayList;
import java.util.List;
@ -8,11 +10,23 @@ public class GenericAdapter {
public String id = "";
public String type = "";
public String physicalLocation = "";
public List<Number> receivedPackets = new ArrayList<>();
public List<Number> sentPackets = new ArrayList<>();
public List<Number> droppedPackets = new ArrayList<>();
public List<Number> sentBytes = new ArrayList<>();
public List<Number> receivedBytes = new ArrayList<>();
public List<Number> transferredBytes = new ArrayList<>();
@FirstElement
public Number receivedPackets = 0.0;
@FirstElement
public Number sentPackets = 0.0;
@FirstElement
public Number droppedPackets = 0.0;
@FirstElement
public Number sentBytes = 0.0;
@FirstElement
public Number receivedBytes = 0.0;
@FirstElement
public Number transferredBytes = 0.0;
}

View file

@ -5,6 +5,7 @@ import java.util.List;
public class Network {
public List<String> clientLpars = new ArrayList<>();
public List<GenericAdapter> genericAdapters = new ArrayList<>();
public List<SharedAdapter> sharedAdapters = new ArrayList<>();
public List<VirtualEthernetAdapter> virtualEthernetAdapters = new ArrayList<>();

View file

@ -1,14 +1,25 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
import java.util.ArrayList;
import java.util.List;
public class PhysicalProcessorPool {
public List<Number> assignedProcUnits = new ArrayList<>();
public List<Number> utilizedProcUnits = new ArrayList<>();
public List<Number> availableProcUnits = new ArrayList<>();
public List<Number> configuredProcUnits = new ArrayList<>();
public List<Number> borrowedProcUnits = new ArrayList<>();
@FirstElement
public Number assignedProcUnits = 0.0;
@FirstElement
public Number utilizedProcUnits = 0.0;
@FirstElement
public Number availableProcUnits = 0.0;
@FirstElement
public Number configuredProcUnits = 0.0;
@FirstElement
public Number borrowedProcUnits = 0.0;
}

View file

@ -16,4 +16,7 @@ public class ServerMemory {
@FirstElement
public Number assignedMemToLpars = 0.0;
@FirstElement
public Number virtualPersistentMem = 0.0;
}

View file

@ -0,0 +1,16 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
import java.util.ArrayList;
import java.util.List;
public class SystemFirmware {
@FirstElement
public Number utilizedProcUnits = 0.0;
@FirstElement
public Number assignedMem = 0.0;
}

View file

@ -1,5 +1,7 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
import java.util.ArrayList;
import java.util.List;
@ -13,6 +15,8 @@ public class UtilInfo {
public String mtms = "";
public String name = "";
public String uuid = "";
public List<String> metricArrayOrder = new ArrayList<>();
@FirstElement
public String metricArrayOrder = "";
}

View file

@ -9,6 +9,7 @@ public class UtilSample {
public String sampleType = "";
public SampleInfo sampleInfo = new SampleInfo();
public SystemFirmware systemFirmwareUtil = new SystemFirmware();
public ServerUtil serverUtil = new ServerUtil();
public EnergyUtil energyUtil = new EnergyUtil();
public List<ViosUtil> viosUtil = new ArrayList<>();

View file

@ -1,5 +1,7 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
import java.util.ArrayList;
import java.util.List;
@ -10,11 +12,23 @@ public class VirtualFiberChannelAdapter {
public String physicalLocation = "";
public String physicalPortWWPN = "";
public Integer viosId = 0;
public List<Number> numOfReads = new ArrayList<>();
public List<Number> numOfWrites = new ArrayList<>();
public List<Number> readBytes = new ArrayList<>();
public List<Number> writeBytes = new ArrayList<>();
public List<Number> runningSpeed = new ArrayList<>();
public List<Number> transmittedBytes = new ArrayList<>();
@FirstElement
public Number numOfReads = 0.0;
@FirstElement
public Number numOfWrites = 0.0;
@FirstElement
public Number readBytes = 0.0;
@FirstElement
public Number writeBytes = 0.0;
@FirstElement
public Number runningSpeed = 0.0;
@FirstElement
public Number transmittedBytes = 0.0;
}

View file

@ -24,6 +24,29 @@ class LogicalPartitionTest extends Specification {
}
void "test getDetails"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system)
when:
lpar.processMetrics(testJson)
List<Measurement> listOfMeasurements = lpar.getDetails()
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['affinityScore'] == 100.0
listOfMeasurements.first().fields['osType'] == 'Linux'
listOfMeasurements.first().fields['type'] == 'AIX/Linux'
listOfMeasurements.first().tags['lparname'] == '9Flash01'
}
void "test getMemoryMetrics"() {
setup:
@ -39,7 +62,7 @@ class LogicalPartitionTest extends Specification {
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['logicalMem'] == 8192.000
listOfMeasurements.first().tags['partition'] == '9Flash01'
listOfMeasurements.first().tags['lparname'] == '9Flash01'
}
@ -58,7 +81,7 @@ class LogicalPartitionTest extends Specification {
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['utilizedProcUnits'] == 0.001
listOfMeasurements.first().tags['partition'] == '9Flash01'
listOfMeasurements.first().tags['lparname'] == '9Flash01'
}
@ -77,7 +100,7 @@ class LogicalPartitionTest extends Specification {
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['receivedBytes'] == 276.467
listOfMeasurements.first().tags['sea'] == 'ent5'
listOfMeasurements.first().tags['location'] == 'U9009.42A.21F64EV-V13-C32'
}
void "test getVirtualFiberChannelAdaptersMetrics"() {
@ -90,7 +113,7 @@ class LogicalPartitionTest extends Specification {
when:
lpar.processMetrics(testJson)
List<Measurement> listOfMeasurements = lpar.getVirtualFiberChannelAdaptersMetrics()
List<Measurement> listOfMeasurements = lpar.getVirtualFibreChannelAdapterMetrics()
then:
listOfMeasurements.size() == 4

View file

@ -24,6 +24,23 @@ class ManagedSystemTest extends Specification {
}
void "test getDetails"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
when:
system.processMetrics(testJson)
List<Measurement> listOfMeasurements = system.getDetails()
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().tags['servername'] == 'Test Name'
listOfMeasurements.first().fields['utilizedProcUnits'] == 0.0
listOfMeasurements.first().fields['assignedMem'] == 5632.0
}
void "test getMemoryMetrics"() {
@ -103,7 +120,6 @@ class ManagedSystemTest extends Specification {
listOfMeasurements.size() == 2
listOfMeasurements.first().fields['assignedMem'] == 8192.000
listOfMeasurements.first().fields['utilizedMem'] == 2093.000
listOfMeasurements.first().fields['utilizedMemPct'] == 25.000
}
void "test getViosProcessorMetrics"() {