Fixed issue where map was overridden and only last value saved.
This commit is contained in:
parent
45f6dd05fd
commit
1f2235f16d
|
@ -1,2 +1,2 @@
|
|||
group = biz.nellemann.hmci
|
||||
version = 1.0.5
|
||||
version = 1.0.7
|
||||
|
|
|
@ -133,8 +133,16 @@ class InfluxClient {
|
|||
batchPoints.point(it)
|
||||
}
|
||||
|
||||
getSystemGenericPhysicalAdapters(system, timestamp).each {
|
||||
batchPoints.point(it)
|
||||
}
|
||||
|
||||
getSystemGenericVirtualAdapters(system, timestamp).each {
|
||||
batchPoints.point(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static List<Point> getSystemMemory(ManagedSystem system, Instant timestamp) {
|
||||
List<Map> metrics = system.getMemoryMetrics()
|
||||
return processMeasurementMap(metrics, timestamp, "SystemMemory")
|
||||
|
@ -160,6 +168,16 @@ class InfluxClient {
|
|||
return processMeasurementMap(metrics, timestamp, "SystemFiberChannelAdapters")
|
||||
}
|
||||
|
||||
private static List<Point> getSystemGenericPhysicalAdapters(ManagedSystem system, Instant timestamp) {
|
||||
List<Map> metrics = system.getSystemGenericPhysicalAdapters()
|
||||
return processMeasurementMap(metrics, timestamp, "SystemGenericPhysicalAdapters")
|
||||
}
|
||||
|
||||
private static List<Point> getSystemGenericVirtualAdapters(ManagedSystem system, Instant timestamp) {
|
||||
List<Map> metrics = system.getSystemGenericVirtualAdapters()
|
||||
return processMeasurementMap(metrics, timestamp, "SystemGenericVirtualAdapters")
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Logical Partitions
|
||||
|
@ -180,6 +198,10 @@ class InfluxClient {
|
|||
|
||||
//BatchPoints batchPoints = BatchPoints.database(database).build();
|
||||
|
||||
getPartitionAffinityScore(partition, timestamp).each {
|
||||
batchPoints.point(it)
|
||||
}
|
||||
|
||||
getPartitionMemory(partition, timestamp).each {
|
||||
batchPoints.point(it)
|
||||
}
|
||||
|
@ -199,6 +221,11 @@ class InfluxClient {
|
|||
//influxDB.write(batchPoints);
|
||||
}
|
||||
|
||||
private static List<Point> getPartitionAffinityScore(LogicalPartition partition, Instant timestamp) {
|
||||
List<Map> metrics = partition.getAffinityScore()
|
||||
return processMeasurementMap(metrics, timestamp, "PartitionAffinityScore")
|
||||
}
|
||||
|
||||
private static List<Point> getPartitionMemory(LogicalPartition partition, Instant timestamp) {
|
||||
List<Map> metrics = partition.getMemoryMetrics()
|
||||
return processMeasurementMap(metrics, timestamp, "PartitionMemory")
|
||||
|
@ -233,6 +260,7 @@ class InfluxClient {
|
|||
|
||||
// Iterate fields
|
||||
map.get("fields").each { String fieldName, BigDecimal fieldValue ->
|
||||
log.debug("processMeasurementMap() " + measurement + " - fieldName: " + fieldName + ", fieldValue: " + fieldValue)
|
||||
|
||||
Point.Builder builder = Point.measurement(measurement)
|
||||
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS)
|
||||
|
@ -242,6 +270,7 @@ class InfluxClient {
|
|||
// For each field, we add all tags
|
||||
map.get("tags").each { String tagName, String tagValue ->
|
||||
builder.tag(tagName, tagValue)
|
||||
log.debug("processMeasurementMap() " + measurement + " - tagName: " + tagName + ", tagValue: " + tagValue)
|
||||
}
|
||||
|
||||
list.add(builder.build())
|
||||
|
|
|
@ -37,6 +37,29 @@ class LogicalPartition extends MetaSystem {
|
|||
}
|
||||
|
||||
|
||||
List<Map> getAffinityScore() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
system: system.name,
|
||||
partition: name,
|
||||
]
|
||||
map.put("tags", tagsMap)
|
||||
log.debug("getAffinityScore() - tags: " + tagsMap.toString())
|
||||
|
||||
HashMap<String, BigDecimal> fieldsMap = [
|
||||
affinityScore: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.affinityScore,
|
||||
]
|
||||
map.put("fields", fieldsMap)
|
||||
log.debug("getAffinityScore() - fields: " + fieldsMap.toString())
|
||||
|
||||
list.add(map)
|
||||
return list
|
||||
}
|
||||
|
||||
|
||||
List<Map> getMemoryMetrics() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
|
@ -75,10 +98,10 @@ class LogicalPartition extends MetaSystem {
|
|||
|
||||
HashMap<String, BigDecimal> fieldsMap = [
|
||||
utilizedProcUnits: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.processor?.utilizedProcUnits?.first(),
|
||||
//maxVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxVirtualProcessors.first(),
|
||||
//currentVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.currentVirtualProcessors.first(),
|
||||
maxVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxVirtualProcessors.first(),
|
||||
currentVirtualProcessors: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.currentVirtualProcessors.first(),
|
||||
//donatedProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.donatedProcUnits.first(),
|
||||
//entitledProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.entitledProcUnits.first(),
|
||||
entitledProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.entitledProcUnits.first(),
|
||||
//idleProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.idleProcUnits.first(),
|
||||
//maxProcUnits: metrics.systemUtil.utilSamples.first().lparsUtil.first().processor.maxProcUnits.first(),
|
||||
utilizedCappedProcUnits: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.processor?.utilizedCappedProcUnits?.first(),
|
||||
|
@ -97,8 +120,8 @@ class LogicalPartition extends MetaSystem {
|
|||
List<Map> getVirtualEthernetAdapterMetrics() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.network?.virtualEthernetAdapters?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
system: system.name,
|
||||
|
@ -131,8 +154,8 @@ class LogicalPartition extends MetaSystem {
|
|||
List<Map> getVirtualFiberChannelAdaptersMetrics() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.storage?.virtualFiberChannelAdapters?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
system: system.name,
|
||||
|
@ -146,6 +169,7 @@ class LogicalPartition extends MetaSystem {
|
|||
HashMap<String, BigDecimal> fieldsMap = [
|
||||
transmittedBytes: it.transmittedBytes.first(),
|
||||
writeBytes: it.writeBytes.first(),
|
||||
readBytes: it.readBytes.first(),
|
||||
]
|
||||
map.put("fields", fieldsMap)
|
||||
log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString())
|
||||
|
|
|
@ -96,8 +96,8 @@ class ManagedSystem extends MetaSystem {
|
|||
List<Map> getSharedProcessorPools() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.serverUtil?.sharedProcessorPool?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
system: name,
|
||||
|
@ -124,10 +124,9 @@ class ManagedSystem extends MetaSystem {
|
|||
List<Map> getSystemSharedAdapters() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.viosUtil?.each {vios ->
|
||||
|
||||
vios.network.sharedAdapters.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
system: name,
|
||||
|
@ -157,11 +156,13 @@ class ManagedSystem extends MetaSystem {
|
|||
List<Map> getSystemFiberChannelAdapters() {
|
||||
|
||||
List<Map> list = new ArrayList<>()
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.viosUtil?.each { vios ->
|
||||
log.debug("getSystemFiberChannelAdapters() - VIOS: " + vios.name)
|
||||
vios.storage?.fiberChannelAdapters?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
id: it.id,
|
||||
system: name,
|
||||
wwpn: it.wwpn,
|
||||
vios: vios.name,
|
||||
|
@ -178,6 +179,38 @@ class ManagedSystem extends MetaSystem {
|
|||
map.put("fields", fieldsMap)
|
||||
log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString())
|
||||
|
||||
list.add(map)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
|
||||
List<Map> getSystemGenericPhysicalAdapters() {
|
||||
List<Map> list = new ArrayList<>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.viosUtil?.each { vios ->
|
||||
vios.storage?.genericPhysicalAdapters?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
id: it.id,
|
||||
system: name,
|
||||
vios: vios.name,
|
||||
device: it.physicalLocation,
|
||||
]
|
||||
map.put("tags", tagsMap)
|
||||
log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString())
|
||||
|
||||
HashMap<String, BigDecimal> fieldsMap = [
|
||||
writeBytes: it.writeBytes.first(),
|
||||
readBytes: it.readBytes.first(),
|
||||
transmittedBytes: it.transmittedBytes.first(),
|
||||
]
|
||||
map.put("fields", fieldsMap)
|
||||
log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString())
|
||||
|
||||
list.add(map)
|
||||
|
||||
}
|
||||
|
@ -188,4 +221,36 @@ class ManagedSystem extends MetaSystem {
|
|||
}
|
||||
|
||||
|
||||
List<Map> getSystemGenericVirtualAdapters() {
|
||||
List<Map> list = new ArrayList<>()
|
||||
metrics.systemUtil?.utilSamples?.first()?.viosUtil?.each { vios ->
|
||||
vios.storage?.genericVirtualAdapters?.each {
|
||||
Map<String, Map> map = new HashMap<String, Map>()
|
||||
|
||||
HashMap<String, String> tagsMap = [
|
||||
id: it.id,
|
||||
system: name,
|
||||
vios: vios.name,
|
||||
device: it.physicalLocation,
|
||||
]
|
||||
map.put("tags", tagsMap)
|
||||
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString())
|
||||
|
||||
HashMap<String, BigDecimal> fieldsMap = [
|
||||
writeBytes: it.writeBytes.first(),
|
||||
readBytes: it.readBytes.first(),
|
||||
transmittedBytes: it.transmittedBytes.first(),
|
||||
]
|
||||
map.put("fields", fieldsMap)
|
||||
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString())
|
||||
|
||||
list.add(map)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ class GenericVirtualAdapter {
|
|||
String type
|
||||
Integer viosId
|
||||
String physicalLocation
|
||||
BigDecimal numOfReads
|
||||
BigDecimal numOfWrites
|
||||
BigDecimal readBytes
|
||||
BigDecimal writeBytes
|
||||
BigDecimal transmittedBytes
|
||||
List<BigDecimal> numOfReads
|
||||
List<BigDecimal> numOfWrites
|
||||
List<BigDecimal> readBytes
|
||||
List<BigDecimal> writeBytes
|
||||
List<BigDecimal> transmittedBytes
|
||||
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
then:
|
||||
listOfMaps.size() == 4
|
||||
listOfMaps.first().get("fields")['writeBytes'] == 546.133
|
||||
listOfMaps.first().get("tags")['viosId'] == '2'
|
||||
listOfMaps.first().get("fields")['writeBytes'] == 6690.133
|
||||
listOfMaps.first().get("tags")['viosId'] == '1'
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue