Merged in cleanup (pull request #8)

Cleanup
This commit is contained in:
Mark Nellemann 2020-12-01 12:19:43 +00:00
commit 76b6ad24ab
7 changed files with 114 additions and 202 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.idea .idea
.vscode
.gradle .gradle
.project .project
.classpath .classpath

View file

@ -6,7 +6,7 @@ plugins {
// Code coverage of tests // Code coverage of tests
id 'jacoco' id 'jacoco'
id "com.github.johnrengelman.shadow" version "6.0.0" id "com.github.johnrengelman.shadow" version "6.1.0"
id "net.nemerosa.versioning" version "2.14.0" id "net.nemerosa.versioning" version "2.14.0"
id "nebula.ospackage" version "8.4.1" id "nebula.ospackage" version "8.4.1"
} }
@ -16,8 +16,8 @@ repositories {
} }
dependencies { dependencies {
annotationProcessor 'info.picocli:picocli-codegen:4.5.1' annotationProcessor 'info.picocli:picocli-codegen:4.5.2'
implementation 'info.picocli:picocli:4.5.1' implementation 'info.picocli:picocli:4.5.2'
implementation 'org.jsoup:jsoup:1.13.1' implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.squareup.moshi:moshi:1.11.0' implementation 'com.squareup.moshi:moshi:1.11.0'
@ -27,7 +27,7 @@ dependencies {
implementation 'org.slf4j:slf4j-api:1.7.+' implementation 'org.slf4j:slf4j-api:1.7.+'
runtimeOnly 'ch.qos.logback:logback-classic:1.+' runtimeOnly 'ch.qos.logback:logback-classic:1.+'
testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0') testImplementation('org.spockframework:spock-core:2.0-M4-groovy-3.0')
testImplementation('com.squareup.okhttp3:mockwebserver:4.9.0') testImplementation('com.squareup.okhttp3:mockwebserver:4.9.0')
testImplementation("org.slf4j:slf4j-simple:1.7.+") testImplementation("org.slf4j:slf4j-simple:1.7.+")
//implementation platform('org.testcontainers:testcontainers-bom:1.14.3') //import bom //implementation platform('org.testcontainers:testcontainers-bom:1.14.3') //import bom

View file

@ -1,3 +1,3 @@
id = hmci id = hmci
group = biz.nellemann.hmci group = biz.nellemann.hmci
version = 0.2.3 version = 0.2.4

View file

@ -193,7 +193,7 @@ class HmcClient {
Map<String, LogicalPartition> getLogicalPartitionsForManagedSystem(ManagedSystem system) throws Exception { Map<String, LogicalPartition> getLogicalPartitionsForManagedSystem(ManagedSystem system) throws Exception {
URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id)); URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id));
String responseBody = getResponse(url); String responseBody = getResponse(url);
Map<String, LogicalPartition> partitionMap = new HashMap<String, LogicalPartition>() {}; Map<String, LogicalPartition> partitionMap = new HashMap<String, LogicalPartition>();
// Do not try to parse empty response // Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) { if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {

View file

@ -49,24 +49,14 @@ class LogicalPartition extends MetaSystem {
List<Measurement> getAffinityScore() { List<Measurement> getAffinityScore() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<String, Map>()
Map<String, String> tagsMap = new HashMap<String, String>() { Map<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", system.name);
put("system", system.name); tagsMap.put("partition", name);
put("partition", name);
}
};
//map.put("tags", tagsMap)
log.debug("getAffinityScore() - tags: " + tagsMap.toString()); log.debug("getAffinityScore() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>() {
{
put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore);
}
};
//map.put("fields", fieldsMap) Map<String, Number> fieldsMap = new HashMap<String, Number>();
fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore);
log.debug("getAffinityScore() - fields: " + fieldsMap.toString()); log.debug("getAffinityScore() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); Measurement measurement = new Measurement(tagsMap, fieldsMap);
@ -78,27 +68,15 @@ class LogicalPartition extends MetaSystem {
List<Measurement> getMemoryMetrics() { List<Measurement> getMemoryMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<String, Map>()
Map<String, String> tagsMap = new HashMap<String, String>() { Map<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", system.name);
put("system", system.name); tagsMap.put("partition", name);
put("partition", name);
}
};
//map.put("tags", tagsMap)
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString()); log.debug("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>() { Map<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("logicalMem", metrics.systemUtil.sample.lparsUtil.memory.logicalMem);
put("logicalMem", metrics.systemUtil.sample.lparsUtil.memory.logicalMem); fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem);
put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem);
}
};
//map.put("fields", fieldsMap)
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString()); log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); Measurement measurement = new Measurement(tagsMap, fieldsMap);
@ -111,35 +89,24 @@ class LogicalPartition extends MetaSystem {
List<Measurement> getProcessorMetrics() { List<Measurement> getProcessorMetrics() {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", system.name);
put("system", system.name); tagsMap.put("partition", name);
put("partition", name);
}
};
//map.put("tags", tagsMap)
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString()); log.debug("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits);
put("utilizedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits); fieldsMap.put("maxVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.maxVirtualProcessors);
put("maxVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.maxVirtualProcessors); fieldsMap.put("currentVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.currentVirtualProcessors);
put("currentVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.currentVirtualProcessors); //fieldsMap.donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(),
//donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(), fieldsMap.put("entitledProcUnits", metrics.systemUtil.sample.lparsUtil.processor.entitledProcUnits);
put("entitledProcUnits", metrics.systemUtil.sample.lparsUtil.processor.entitledProcUnits); //fieldsMap.idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(),
//idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(), //fieldsMap.maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(),
//maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(), fieldsMap.put("utilizedCappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedCappedProcUnits);
put("utilizedCappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedCappedProcUnits); fieldsMap.put("utilizedUncappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedUncappedProcUnits);
put("utilizedUncappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedUncappedProcUnits); fieldsMap.put("timePerInstructionExecution", metrics.systemUtil.sample.lparsUtil.processor.timeSpentWaitingForDispatch);
put("timePerInstructionExecution", metrics.systemUtil.sample.lparsUtil.processor.timeSpentWaitingForDispatch); fieldsMap.put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution);
put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution);
}
};
//map.put("fields", fieldsMap)
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString()); log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); Measurement measurement = new Measurement(tagsMap, fieldsMap);
@ -154,26 +121,20 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.forEach( adapter -> { metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", system.name);
put("system", system.name); tagsMap.put("partition", name);
put("partition", name); tagsMap.put("sea", adapter.sharedEthernetAdapterId);
put("sea", adapter.sharedEthernetAdapterId); tagsMap.put("viosId", adapter.viosId.toString());
put("viosId", adapter.viosId.toString()); tagsMap.put("vlanId", adapter.vlanId.toString());
put("vlanId", adapter.vlanId.toString()); tagsMap.put("vswitchId", adapter.vswitchId.toString());
put("vswitchId", adapter.vswitchId.toString());
}
};
log.debug("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap.toString()); log.debug("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes);
put("receivedPhysicalBytes", adapter.receivedPhysicalBytes); fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes);
put("sentPhysicalBytes", adapter.sentPhysicalBytes); fieldsMap.put("receivedBytes", adapter.receivedBytes);
put("receivedBytes", adapter.receivedBytes); fieldsMap.put("sentBytes", adapter.sentBytes);
put("sentBytes", adapter.sentBytes);
}
};
log.debug("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString()); log.debug("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); Measurement measurement = new Measurement(tagsMap, fieldsMap);
@ -190,29 +151,18 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> { metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> {
//Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", system.name);
put("system", system.name); tagsMap.put("partition", name);
put("partition", name); tagsMap.put("viosId", adapter.viosId.toString());
put("viosId", adapter.viosId.toString()); tagsMap.put("wwpn", adapter.wwpn);
put("wwpn", adapter.wwpn);
}
};
//map.put("tags", tagsMap)
log.debug("getVirtualFiberChannelAdaptersMetrics() - tags: " + tagsMap.toString()); log.debug("getVirtualFiberChannelAdaptersMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("transmittedBytes", adapter.transmittedBytes.get(0));
put("transmittedBytes", adapter.transmittedBytes.get(0)); fieldsMap.put("writeBytes", adapter.writeBytes.get(0));
put("writeBytes", adapter.writeBytes.get(0)); fieldsMap.put("readBytes", adapter.readBytes.get(0));
put("readBytes", adapter.readBytes.get(0));
}
};
//map.put("fields", fieldsMap)
log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString()); log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString());
Measurement measurement = new Measurement(tagsMap, fieldsMap); Measurement measurement = new Measurement(tagsMap, fieldsMap);

View file

@ -54,23 +54,17 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<String, Map>() //Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", name);
put("system", name);
}
};
//map.put("tags", tagsMap) //map.put("tags", tagsMap)
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString()); log.debug("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>() { Map<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("totalMem", metrics.systemUtil.sample.serverUtil.memory.totalMem);
put("totalMem", metrics.systemUtil.sample.serverUtil.memory.totalMem); fieldsMap.put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem);
put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem); fieldsMap.put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem);
put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem); fieldsMap.put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars);
put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars);
}
};
//map.put("fields", fieldsMap) //map.put("fields", fieldsMap)
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString()); log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString());
@ -87,24 +81,19 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>(); List<Measurement> list = new ArrayList<>();
//Map<String, Map> map = new HashMap<>() //Map<String, Map> map = new HashMap<>()
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", name);
put("system", name);
}
};
//map.put("tags", tagsMap) //map.put("tags", tagsMap)
//measurement.tags = tagsMap; //measurement.tags = tagsMap;
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString()); log.debug("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("totalProcUnits", metrics.systemUtil.sample.serverUtil.processor.totalProcUnits);
put("totalProcUnits", metrics.systemUtil.sample.serverUtil.processor.totalProcUnits); fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits);
put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits); fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits);
put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits); fieldsMap.put("configurableProcUnits", metrics.systemUtil.sample.serverUtil.processor.configurableProcUnits);
put("configurableProcUnits", metrics.systemUtil.sample.serverUtil.processor.configurableProcUnits);
}
};
//map.put("fields", fieldsMap) //map.put("fields", fieldsMap)
//measurement.fields = fieldsMap; //measurement.fields = fieldsMap;
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString()); log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString());
@ -122,22 +111,16 @@ class ManagedSystem extends MetaSystem {
metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> { metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> {
//Map<String, Map> map = new HashMap<String, Map>() //Map<String, Map> map = new HashMap<String, Map>()
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", name);
put("system", name); tagsMap.put("pool", adapter.name);
put("pool", adapter.name);
}
};
//map.put("tags", tagsMap) //map.put("tags", tagsMap)
log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString()); log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("assignedProcUnits", adapter.assignedProcUnits);
put("assignedProcUnits", adapter.assignedProcUnits); fieldsMap.put("availableProcUnits", adapter.availableProcUnits);
put("availableProcUnits", adapter.availableProcUnits);
}
};
//map.put("fields", fieldsMap) //map.put("fields", fieldsMap)
log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString()); log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString());
@ -159,25 +142,20 @@ class ManagedSystem extends MetaSystem {
//Map<String, Map> map = new HashMap<String, Map>() //Map<String, Map> map = new HashMap<String, Map>()
Measurement measurement = new Measurement(); Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("system", name);
put("system", name); tagsMap.put("type", adapter.type);
put("type", adapter.type); tagsMap.put("vios", vios.name);
put("vios", vios.name);
}
};
//map.put("tags", tagsMap) //map.put("tags", tagsMap)
measurement.tags = tagsMap; measurement.tags = tagsMap;
log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("sentBytes", adapter.sentBytes);
put("sentBytes", adapter.sentBytes); fieldsMap.put("receivedBytes", adapter.receivedBytes);
put("receivedBytes", adapter.receivedBytes); fieldsMap.put("transferredBytes", adapter.transferredBytes);
put("transferredBytes", adapter.transferredBytes);
}
};
//map.put("fields", fieldsMap) //map.put("fields", fieldsMap)
measurement.fields = fieldsMap; measurement.fields = fieldsMap;
log.debug("getSystemSharedAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemSharedAdapters() - fields: " + fieldsMap.toString());
@ -201,27 +179,22 @@ class ManagedSystem extends MetaSystem {
//HashMap<String, Map> map = new HashMap<>() //HashMap<String, Map> map = new HashMap<>()
Measurement measurement = new Measurement(); Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("id", adapter.id);
put("id", adapter.id); tagsMap.put("system", name);
put("system", name); tagsMap.put("wwpn", adapter.wwpn);
put("wwpn", adapter.wwpn); tagsMap.put("vios", vios.name);
put("vios", vios.name); tagsMap.put("device", adapter.physicalLocation);
put("device", adapter.physicalLocation);
}
};
//map.put("tags", tagsMap) //map.put("tags", tagsMap)
measurement.tags = tagsMap; measurement.tags = tagsMap;
log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("writeBytes", adapter.writeBytes);
put("writeBytes", adapter.writeBytes); fieldsMap.put("readBytes", adapter.readBytes);
put("readBytes", adapter.readBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
put("transmittedBytes", adapter.transmittedBytes);
}
};
//map.put("fields", fieldsMap) //map.put("fields", fieldsMap)
measurement.fields = fieldsMap; measurement.fields = fieldsMap;
log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString());
@ -245,25 +218,19 @@ class ManagedSystem extends MetaSystem {
Measurement measurement = new Measurement(); Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("id", adapter.id);
put("id", adapter.id); tagsMap.put("system", name);
put("system", name); tagsMap.put("vios", vios.name);
put("vios", vios.name); tagsMap.put("device", adapter.physicalLocation);
put("device", adapter.physicalLocation);
}
};
measurement.tags = tagsMap; measurement.tags = tagsMap;
log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("writeBytes", adapter.writeBytes);
put("writeBytes", adapter.writeBytes); fieldsMap.put("readBytes", adapter.readBytes);
put("readBytes", adapter.readBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
put("transmittedBytes", adapter.transmittedBytes);
}
};
measurement.fields = fieldsMap; measurement.fields = fieldsMap;
log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString());
@ -287,25 +254,19 @@ class ManagedSystem extends MetaSystem {
Measurement measurement = new Measurement(); Measurement measurement = new Measurement();
HashMap<String, String> tagsMap = new HashMap<String, String>() { HashMap<String, String> tagsMap = new HashMap<String, String>();
{ tagsMap.put("id", adapter.id);
put("id", adapter.id); tagsMap.put("system", name);
put("system", name); tagsMap.put("vios", vios.name);
put("vios", vios.name); tagsMap.put("device", adapter.physicalLocation);
put("device", adapter.physicalLocation);
}
};
measurement.tags = tagsMap; measurement.tags = tagsMap;
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString()); log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>() { HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
{ fieldsMap.put("writeBytes", adapter.writeBytes);
put("writeBytes", adapter.writeBytes); fieldsMap.put("readBytes", adapter.readBytes);
put("readBytes", adapter.readBytes); fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
put("transmittedBytes", adapter.transmittedBytes);
}
};
measurement.fields = fieldsMap; measurement.fields = fieldsMap;
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString()); log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());

View file

@ -95,7 +95,7 @@ abstract class MetaSystem {
@FromJson @FromJson
Number fromJson(String string) { Number fromJson(String string) {
return new Double(string); return Double.parseDouble(string);
} }
@ToJson @ToJson