From ccbbbe65418027212654ce053fc4a792cbc13a93 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Fri, 7 Aug 2020 13:20:07 +0200 Subject: [PATCH] Work on fetching PCM Json for later processing. --- build.gradle | 1 - src/main/groovy/biz/nellemann/hmci/App.groovy | 6 +- src/main/groovy/biz/nellemann/hmci/Hmc.groovy | 125 ++- .../hmci/{pojo => }/LogicalPartition.groovy | 8 +- .../hmci/{pojo => }/ManagedSystem.groovy | 8 +- .../groovy/biz/nellemann/hmci/HmcTest.groovy | 86 +- src/test/resources/logical-partition-pcm.json | 222 +++++ src/test/resources/managed-system-pcm.json | 805 ++++++++++++++++++ ...naged-system.xml => processed-metrics.xml} | 84 +- 9 files changed, 1238 insertions(+), 107 deletions(-) rename src/main/groovy/biz/nellemann/hmci/{pojo => }/LogicalPartition.groovy (61%) rename src/main/groovy/biz/nellemann/hmci/{pojo => }/ManagedSystem.groovy (73%) create mode 100644 src/test/resources/logical-partition-pcm.json create mode 100644 src/test/resources/managed-system-pcm.json rename src/test/resources/{processed-metrics-for-managed-system.xml => processed-metrics.xml} (72%) diff --git a/build.gradle b/build.gradle index a5694b3..3ae2c78 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,6 @@ dependencies { runtimeOnly 'ch.qos.logback:logback-classic:1.+' // Use the awesome Spock testing and specification framework - //testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5' testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0') testImplementation("org.slf4j:slf4j-simple:1.7.+") testImplementation('com.squareup.okhttp3:mockwebserver:4.8.0') diff --git a/src/main/groovy/biz/nellemann/hmci/App.groovy b/src/main/groovy/biz/nellemann/hmci/App.groovy index 5485764..f352946 100644 --- a/src/main/groovy/biz/nellemann/hmci/App.groovy +++ b/src/main/groovy/biz/nellemann/hmci/App.groovy @@ -30,17 +30,13 @@ class App { hmc.getManagedSystems() hmc.getLogicalPartitions() - //hmc.getManagedSystemProcessedMetrics() - //hmc.getLogicalPartitionProcessedMetrics() + hmc.getProcessedMetrics() hmc.logoff() } catch(Exception e) { log.error(e.message) } - hmc?.managedSystems?.each { - println("Found system: " + it.name) - } System.exit(0); } diff --git a/src/main/groovy/biz/nellemann/hmci/Hmc.groovy b/src/main/groovy/biz/nellemann/hmci/Hmc.groovy index db4c795..76bf5fa 100644 --- a/src/main/groovy/biz/nellemann/hmci/Hmc.groovy +++ b/src/main/groovy/biz/nellemann/hmci/Hmc.groovy @@ -1,7 +1,7 @@ package biz.nellemann.hmci -import biz.nellemann.hmci.pojo.LogicalPartition -import biz.nellemann.hmci.pojo.ManagedSystem + +import groovy.json.JsonSlurper import groovy.util.logging.Slf4j import groovy.xml.XmlSlurper import okhttp3.MediaType @@ -73,12 +73,11 @@ class Hmc { def xml = new XmlSlurper().parseText(responseBody) authToken = xml.toString() - log.debug("Auth Token: " + authToken) + log.debug("login() - Auth Token: " + authToken) } void logoff() { - URL absUrl = new URL(String.format("%s/rest/api/web/Logon", baseUrl)) Request request = new Request.Builder() .url(absUrl) @@ -91,11 +90,15 @@ class Hmc { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); this.authToken = null + log.debug("logoff()") + } void getManagedSystems() { + log.debug("getManagedSystems()") + URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem", baseUrl)) Response response = getResponse(url) String responseBody = response.body.string() @@ -119,14 +122,16 @@ class Hmc { } - void getLogicalPartitions(ManagedSystem system) { + void getLogicalPartitions() { + log.debug("getLogicalPartitions()") managedSystems.each { - getLogicalPartitionsForManagedSystem(it) + getLogicalPartitionsForManagedSystem(it.getValue()) } } void getLogicalPartitionsForManagedSystem(ManagedSystem system) { + log.debug("getLogicalPartitionsForManagedSystem() - " + system.name) URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id)) Response response = getResponse(url) @@ -152,50 +157,114 @@ class Hmc { } - void getManagedSystemProcessedMetrics() { + void getProcessedMetrics() { managedSystems.each { - getManagedSystemProcessedMetricsForManagedSystem(it) + getProcessedMetricsForManagedSystem(it.getValue()) } } - void getManagedSystemProcessedMetricsForManagedSystem(ManagedSystem system) { - URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics", baseUrl, system.id)) + + void getProcessedMetricsForManagedSystem(ManagedSystem system) { + log.debug("getProcessedMetricsForManagedSystem() " - system.name) + URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=1", baseUrl, system.id)) Response response = getResponse(url) String responseBody = response.body.string() - log.debug(responseBody) - } + //log.debug(responseBody) - - void getLogicalPartitionProcessedMetrics() { - managedSystems.each { - it.partitions.each { - getLogicalPartitionProcessedMetricsForLogicalPartition(it) + def feed = new XmlSlurper().parseText(responseBody) + feed?.entry?.each { entry -> + String link = entry.link["@href"] + //linksList.add(link) + switch (entry.category["@term"]) { + case "ManagedSystem": + processPcmJsonForManagedSystem(getPcmJsonForManagedSystem(link)) + break + case "LogicalPartition": + //processPcmJsonForLogicalPartition(getPcmJsonForLogicalPartition(getProcessedMetricsForLogicalPartition(link))) + break + default: + log.warn("Unknown category: " + entry.category["@term"]) + break } } } - void getLogicalPartitionProcessedMetricsForLogicalPartition(LogicalPartition partition) { - URL url = new URL(String.format("%s/rest/api/pcm/LogicalPartition/%s/ProcessedMetrics", baseUrl, partition.id)) - log.debug("getLogicalPartitionProcessedMetricsForLogicalPartition() " + url.toString()) + /** + * Parse XML to get JSON Link + * @param pcmUrl + */ + String getProcessedMetricsForLogicalPartition(String pcmUrl) { + log.debug("getProcessedMetricsForLogicalPartition() - " + pcmUrl) + URL url = new URL(pcmUrl) Response response = getResponse(url) String responseBody = response.body.string() - log.debug(responseBody) - /* + String link def feed = new XmlSlurper().parseText(responseBody) feed?.entry?.each { entry -> - if(entry.category["@term"] != category) return - String link = entry.link["@href"] - linksList.add(link) - log.debug(link) - }*/ + link = entry.link["@href"] + } + + return link + } + + + String getPcmJsonForManagedSystem(String jsonUrl) { + log.debug("getPcmJsonForManagedSystem() - " + jsonUrl) + URL url = new URL(jsonUrl) + Response response = getResponse(url) + return response.body.string() + } + + String getPcmJsonForLogicalPartition(String jsonUrl) { + log.debug("getPcmJsonForLogicalPartition() - " + jsonUrl) + URL url = new URL(jsonUrl) + Response response = getResponse(url) + return response.body.string() + } + + + void processPcmJsonForManagedSystem(String json) { + log.debug("processPcmJsonForManagedSystem()") + def jsonObject = new JsonSlurper().parseText(json) + String systemUuid = (String)jsonObject?.systemUtil?.utilInfo?.uuid + if(systemUuid && managedSystems.containsKey(systemUuid)) { + log.debug("processPcmJsonForManagedSystem() - Found UUID for ManagedSystem: " + systemUuid) + ManagedSystem system = managedSystems.get(systemUuid) + // TODO: Store metrics + system.processMetrics() + } + } + + void processPcmJsonForLogicalPartition(String json) { + log.debug("processPcmJsonForLogicalPartition()") + + def jsonObject = new JsonSlurper().parseText(json) + String systemUuid = (String)jsonObject?.utilInfo?.uuid + + if(systemUuid && managedSystems.containsKey(systemUuid)) { + + log.debug("processPcmJsonForLogicalPartition() - Found UUID for ManagedSystem: " + systemUuid) + ManagedSystem system = managedSystems.get(systemUuid) + String lparUuid = (String)jsonObject?.utilSamples?.lparsUtil[0][0]?.uuid + + if(lparUuid && system.partitions.containsKey(lparUuid)) { + + log.debug("processPcmJsonForLogicalPartition() - Found UUID for LogicalPartition: " + lparUuid) + LogicalPartition lpar = system.partitions.get(lparUuid) + // TODO: Store metrics + lpar.processMetrics() + + } + + } } - private Response getResponse(URL url) { + //log.debug("getResponse() - " + url.toString()) Request request = new Request.Builder() .url(url) diff --git a/src/main/groovy/biz/nellemann/hmci/pojo/LogicalPartition.groovy b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy similarity index 61% rename from src/main/groovy/biz/nellemann/hmci/pojo/LogicalPartition.groovy rename to src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy index 716d1bc..15522d4 100644 --- a/src/main/groovy/biz/nellemann/hmci/pojo/LogicalPartition.groovy +++ b/src/main/groovy/biz/nellemann/hmci/LogicalPartition.groovy @@ -1,5 +1,8 @@ -package biz.nellemann.hmci.pojo +package biz.nellemann.hmci +import groovy.util.logging.Slf4j + +@Slf4j class LogicalPartition { public String id @@ -16,4 +19,7 @@ class LogicalPartition { return "[${id}] ${name} (${type})" } + void processMetrics() { + log.info("processMetrics() - TODO: Store metrics here.") + } } diff --git a/src/main/groovy/biz/nellemann/hmci/pojo/ManagedSystem.groovy b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy similarity index 73% rename from src/main/groovy/biz/nellemann/hmci/pojo/ManagedSystem.groovy rename to src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy index a5628f2..8c8a81b 100644 --- a/src/main/groovy/biz/nellemann/hmci/pojo/ManagedSystem.groovy +++ b/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy @@ -1,5 +1,8 @@ -package biz.nellemann.hmci.pojo +package biz.nellemann.hmci +import groovy.util.logging.Slf4j + +@Slf4j class ManagedSystem { public String id @@ -19,4 +22,7 @@ class ManagedSystem { return "[${id}] ${name} (${type}-${model} ${serialNumber})" } + void processMetrics() { + log.info("processMetrics() - TODO: Store metrics here.") + } } diff --git a/src/test/groovy/biz/nellemann/hmci/HmcTest.groovy b/src/test/groovy/biz/nellemann/hmci/HmcTest.groovy index b0c544a..dee836f 100644 --- a/src/test/groovy/biz/nellemann/hmci/HmcTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/HmcTest.groovy @@ -1,6 +1,6 @@ package biz.nellemann.hmci -import biz.nellemann.hmci.pojo.ManagedSystem + import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import spock.lang.Specification @@ -10,16 +10,19 @@ class HmcTest extends Specification { Hmc hmc MockWebServer mockServer = new MockWebServer(); + def setup() { mockServer.start(); hmc = new Hmc(mockServer.url("/").toString(), "testUser", "testPassword") hmc.authToken = "blaBla" } + def cleanup() { mockServer.shutdown() } + void "test getManagedSystems"() { setup: def testFile = new File(getClass().getResource('/managed-systems.xml').toURI()) @@ -31,10 +34,10 @@ class HmcTest extends Specification { then: hmc.managedSystems.size() == 2 - hmc.managedSystems[0].id == "e09834d1-c930-3883-bdad-405d8e26e166" - hmc.managedSystems[0].name == "S822L-8247-213C1BA" + hmc.managedSystems.get("e09834d1-c930-3883-bdad-405d8e26e166").name == "S822L-8247-213C1BA" } + void "test getLogicalPartitionsForManagedSystem"() { setup: def testFile = new File(getClass().getResource('/logical-partitions.xml').toURI()) @@ -43,50 +46,75 @@ class HmcTest extends Specification { when: ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") - hmc.managedSystems.add(system) + hmc.managedSystems.put("e09834d1-c930-3883-bdad-405d8e26e166", system) hmc.getLogicalPartitionsForManagedSystem(system) then: - hmc.managedSystems[0].partitions.size() == 12 - hmc.managedSystems[0].partitions[0].id == "3380A831-9D22-4F03-A1DF-18B249F0FF8E" - hmc.managedSystems[0].partitions[0].name == "AIX_Test1-e0f725f0-00000005" - hmc.managedSystems[0].partitions[0].type == "AIX/Linux" + system.partitions.size() == 12 + system.partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").name == "AIX_Test1-e0f725f0-00000005" + system.partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").type == "AIX/Linux" } - /* - void "test getSystemPCMLinks"() { + + void "test getPcmJsonForManagedSystem"() { setup: - def testFile = new File(getClass().getResource('/managed-system-pcm.xml').toURI()) - def testXml = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testXml)); - ManagedSystem managedSystem = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") + def testFile = new File(getClass().getResource('/managed-system-pcm.json').toURI()) + def testJson = testFile.getText('UTF-8') + mockServer.enqueue(new MockResponse().setBody(testJson)); when: - List links = hmc.getManagedSystemProcessedMetrics(managedSystem) + String jsonString = hmc.getPcmJsonForManagedSystem(mockServer.url("/rest/api/pcm/ProcessedMetrics/ManagedSystem_e09834d1-c930-3883-bdad-405d8e26e166_20200807T122600+0200_20200807T122600+0200_30.json").toString()) then: - links.size() == 1 - //links[0] == "https://10.32.64.39:12443/rest/api/pcm/ProcessedMetrics/ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20200806T183800+0200_20200806T184000+0200_30.json" - - + jsonString.contains('"uuid": "e09834d1-c930-3883-bdad-405d8e26e166"') } - void "test getPartitionPCMLinks"() { + void "test getPcmJsonForLogicalPartition"() { setup: - def testFile = new File(getClass().getResource('/managed-system-pcm.xml').toURI()) - def testXml = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testXml)); - ManagedSystem system = new ManagedSystem() + def testFile = new File(getClass().getResource('/logical-partition-pcm.json').toURI()) + def testJson = testFile.getText('UTF-8') + mockServer.enqueue(new MockResponse().setBody(testJson)); when: - List links = hmc.getPartitionPCMLinks("e09834d1-c930-3883-bdad-405d8e26e166") + String jsonString = hmc.getPcmJsonForLogicalPartition(mockServer.url("/rest/api/pcm/ProcessedMetrics/LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82_20200807T123730+0200_20200807T123730+0200_30.json").toString()) then: - links.size() == 12 - links[0] == "https://10.32.64.39:12443/rest/api/pcm/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559/LogicalPartition/44A89632-E9E6-4E12-91AF-1A33DEE060CF/ProcessedMetrics?NoOfSamples=5" - + jsonString.contains('"uuid": "b597e4da-2aab-3f52-8616-341d62153559"') } - */ + + + void "test processPcmJsonForManagedSystem"() { + + setup: + def testFile = new File(getClass().getResource('/managed-system-pcm.json').toURI()) + def testJson = testFile.getText('UTF-8') + + when: + ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166") + hmc.managedSystems.put("e09834d1-c930-3883-bdad-405d8e26e166", system) + hmc.processPcmJsonForManagedSystem(testJson) + + then: + true == true + } + + void "test processPcmJsonForLogicalPartition"() { + + setup: + def testFile = new File(getClass().getResource('/logical-partition-pcm.json').toURI()) + def testJson = testFile.getText('UTF-8') + + when: + ManagedSystem system = new ManagedSystem("b597e4da-2aab-3f52-8616-341d62153559") + hmc.managedSystems.put("b597e4da-2aab-3f52-8616-341d62153559", system) + LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82") + system.partitions.put("2DE05DB6-8AD5-448F-8327-0F488D287E82", lpar) + hmc.processPcmJsonForLogicalPartition(testJson) + + then: + true == true + } + } diff --git a/src/test/resources/logical-partition-pcm.json b/src/test/resources/logical-partition-pcm.json new file mode 100644 index 0000000..deb1749 --- /dev/null +++ b/src/test/resources/logical-partition-pcm.json @@ -0,0 +1,222 @@ +{ + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-07T12:37:30+0200", + "endTimeStamp": "2020-08-07T12:37:30+0200", + "mtms": "9009-42A*21F64EV", + "name": "Server-9009-42A-SN21F64EV", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "LogicalPartition", + "sampleInfo": { + "timeStamp": "2020-08-07T12:37:30+0200", + "status": 2, + "errorInfo": [ + { + "errId": "3004", + "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "reportedBy": "ManagedSystem", + "occurrenceCount": 1 + }, + { + "errId": "3004", + "errMsg": "Failed to fetch SRIOV adapter physical port statistics due to a technical error.", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "reportedBy": "ManagedSystem", + "occurrenceCount": 1 + } + ] + }, + "lparsUtil": [ + { + "id": 10, + "uuid": "2DE05DB6-8AD5-448F-8327-0F488D287E82", + "name": "P9-PowerVC", + "state": "Running", + "type": "AIX/Linux", + "osType": "Linux", + "affinityScore": 100, + "memory": { + "logicalMem": [ + 112640.000 + ], + "backedPhysicalMem": [ + 112640.000 + ] + }, + "processor": { + "poolId": 0, + "weight": 128, + "mode": "uncap", + "maxVirtualProcessors": [ + 8.000 + ], + "currentVirtualProcessors": [ + 4.000 + ], + "maxProcUnits": [ + 8.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.574 + ], + "utilizedCappedProcUnits": [ + 0.498 + ], + "utilizedUncappedProcUnits": [ + 0.076 + ], + "idleProcUnits": [ + 0.376 + ], + "donatedProcUnits": [ + 0.000 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 0.000 + ] + }, + "network": { + "virtualEthernetAdapters": [ + { + "physicalLocation": "U9009.42A.21F64EV-V10-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "viosId": 1, + "sharedEthernetAdapterId": "ent5", + "receivedPackets": [ + 11.933 + ], + "sentPackets": [ + 7.767 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 2020.467 + ], + "receivedBytes": [ + 4291.167 + ], + "receivedPhysicalPackets": [ + 11.933 + ], + "sentPhysicalPackets": [ + 7.767 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 2020.467 + ], + "receivedPhysicalBytes": [ + 4291.167 + ], + "transferredBytes": [ + 6311.634 + ], + "transferredPhysicalBytes": [ + 6311.634 + ] + } + ] + }, + "storage": { + "genericVirtualAdapters": [ + { + "id": "vhost5", + "type": "virtual", + "viosId": 1, + "physicalLocation": "U9009.42A.21F64EV-V10-C3", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + null + ] + } + ], + "virtualFiberChannelAdapters": [ + { + "wwpn": "c050760b1d10002a", + "wwpn2": "c050760b1d10002b", + "physicalLocation": "U9009.42A.21F64EV-V10-C87", + "physicalPortWWPN": "100000109b89aca8", + "viosId": 1, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 2.867 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 138786.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d10002c", + "wwpn2": "c050760b1d10002d", + "physicalLocation": "U9009.42A.21F64EV-V10-C88", + "physicalPortWWPN": "100000109b7db96a", + "viosId": 2, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 2.933 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 140731.733 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ] + } + } + ] + } + ] +}} diff --git a/src/test/resources/managed-system-pcm.json b/src/test/resources/managed-system-pcm.json new file mode 100644 index 0000000..30d6ad6 --- /dev/null +++ b/src/test/resources/managed-system-pcm.json @@ -0,0 +1,805 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-07T10:44:00+0200", + "endTimeStamp": "2020-08-07T10:44:00+0200", + "mtms": "8247-22L*213C1BA", + "name": "S822L-8247-213C1BA", + "uuid": "e09834d1-c930-3883-bdad-405d8e26e166", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "ManagedSystem", + "sampleInfo": { + "timeStamp": "2020-08-07T10:44:00+0200", + "status": 0 + }, + "systemFirmwareUtil": { + "utilizedProcUnits": [ + 0.000 + ], + "assignedMem": [ + 5632.000 + ] + }, + "serverUtil": { + "processor": { + "totalProcUnits": [ + 24.000 + ], + "utilizedProcUnits": [ + 0.017 + ], + "availableProcUnits": [ + 16.000 + ], + "configurableProcUnits": [ + 24.000 + ] + }, + "memory": { + "totalMem": [ + 1048576.000 + ], + "availableMem": [ + 1001984.000 + ], + "configurableMem": [ + 1048576.000 + ], + "assignedMemToLpars": [ + 40960.000 + ] + }, + "physicalProcessorPool": { + "assignedProcUnits": [ + 23.879 + ], + "utilizedProcUnits": [ + 0.007 + ], + "availableProcUnits": [ + 23.872 + ], + "configuredProcUnits": [ + 0.000 + ], + "borrowedProcUnits": [ + 16.000 + ] + }, + "sharedProcessorPool": [ + { + "id": 0, + "name": "DefaultPool", + "assignedProcUnits": [ + 23.879 + ], + "utilizedProcUnits": [ + 0.005 + ], + "availableProcUnits": [ + 23.874 + ], + "configuredProcUnits": [ + 6.000 + ], + "borrowedProcUnits": [ + 16.000 + ] + } + ] + }, + "viosUtil": [ + { + "id": 1, + "uuid": "2F30379A-860B-4661-A24E-CD8E449C81AC", + "name": "VIOS1", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 8192.000 + ], + "utilizedMem": [ + 2061.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.006 + ], + "utilizedCappedProcUnits": [ + 0.079 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.073 + ], + "donatedProcUnits": [ + 0.921 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 51.000 + ] + }, + "network": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericAdapters": [ + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C10-T3", + "receivedPackets": [ + 29.733 + ], + "sentPackets": [ + 25.900 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 7508.933 + ], + "receivedBytes": [ + 5676.000 + ], + "transferredBytes": [ + 13184.933 + ] + }, + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C3-T1", + "receivedPackets": [ + 12.967 + ], + "sentPackets": [ + 9.700 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3348.667 + ], + "receivedBytes": [ + 2401.733 + ], + "transferredBytes": [ + 5750.400 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 26.900 + ], + "sentPackets": [ + 33.800 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 8853.333 + ], + "receivedBytes": [ + 8214.933 + ], + "transferredBytes": [ + 17068.266 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 56.633 + ], + "sentPackets": [ + 59.700 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 16362.267 + ], + "receivedBytes": [ + 13890.933 + ], + "transferredBytes": [ + 30253.200 + ], + "bridgedAdapters": [ + "ent2", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U8247.22L.213C1BA-V1-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 10.467 + ], + "sentPackets": [ + 14.667 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1931.333 + ], + "receivedBytes": [ + 3875.433 + ], + "receivedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalPackets": [ + 0.000 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 0.000 + ], + "receivedPhysicalBytes": [ + 0.000 + ], + "transferredBytes": [ + 5806.766 + ], + "transferredPhysicalBytes": [ + 0.000 + ] + }, + { + "physicalLocation": "U8247.22L.213C1BA-V1-C3", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 6.100 + ], + "sentPackets": [ + 1.700 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1420.533 + ], + "receivedBytes": [ + 575.100 + ], + "receivedPhysicalPackets": [ + 6.100 + ], + "sentPhysicalPackets": [ + 1.700 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 1420.533 + ], + "receivedPhysicalBytes": [ + 575.100 + ], + "transferredBytes": [ + 1995.633 + ], + "transferredPhysicalBytes": [ + 1995.633 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas0", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C14-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 4.533 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 2321.067 + ], + "transmittedBytes": [ + 2321.067 + ] + } + ], + "genericVirtualAdapters": [ + { + "id": "vhost1", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C6", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "id": "vhost0", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C5", + "numOfReads": [ + 0.500 + ], + "numOfWrites": [ + 0.500 + ], + "readBytes": [ + 256.000 + ], + "writeBytes": [ + 256.000 + ], + "transmittedBytes": [ + 512.000 + ] + }, + { + "id": "vhost2", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C7", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ], + "fiberChannelAdapters": [ + { + "id": "fcs0", + "wwpn": "10000090faba5108", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C12-T1", + "numOfPorts": 3, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.467 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 30583.467 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 30583.467 + ] + }, + { + "id": "fcs1", + "wwpn": "10000090faba5109", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C12-T2", + "numOfPorts": 0, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "runningSpeed": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ] + } + }, + { + "id": 2, + "uuid": "2BA128CE-38E4-4522-B823-7471633C2717", + "name": "VIOS2", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 8192.000 + ], + "utilizedMem": [ + 2090.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.005 + ], + "utilizedCappedProcUnits": [ + 0.042 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.037 + ], + "donatedProcUnits": [ + 0.958 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 52.000 + ] + }, + "network": { + "genericAdapters": [ + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C3-T1", + "receivedPackets": [ + 12.233 + ], + "sentPackets": [ + 9.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3011.200 + ], + "receivedBytes": [ + 2265.067 + ], + "transferredBytes": [ + 5276.267 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 4.600 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3247.600 + ], + "transferredBytes": [ + 3953.600 + ] + }, + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C6-T3", + "receivedPackets": [ + 5.167 + ], + "sentPackets": [ + 0.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 0.000 + ], + "receivedBytes": [ + 380.333 + ], + "transferredBytes": [ + 380.333 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 9.767 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3627.933 + ], + "transferredBytes": [ + 4333.933 + ], + "bridgedAdapters": [ + "ent2", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U8247.22L.213C1BA-V2-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 0.000 + ], + "sentPackets": [ + 0.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 0.000 + ], + "receivedBytes": [ + 0.000 + ], + "receivedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalPackets": [ + 0.000 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 0.000 + ], + "receivedPhysicalBytes": [ + 0.000 + ], + "transferredBytes": [ + 0.000 + ], + "transferredPhysicalBytes": [ + 0.000 + ] + }, + { + "physicalLocation": "U8247.22L.213C1BA-V2-C3", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 5.867 + ], + "sentPackets": [ + 1.567 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1306.633 + ], + "receivedBytes": [ + 517.900 + ], + "receivedPhysicalPackets": [ + 5.867 + ], + "sentPhysicalPackets": [ + 1.567 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 1306.633 + ], + "receivedPhysicalBytes": [ + 517.900 + ], + "transferredBytes": [ + 1824.533 + ], + "transferredPhysicalBytes": [ + 1824.533 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas1", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C15-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 6.400 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 3276.800 + ], + "transmittedBytes": [ + 3276.800 + ] + } + ], + "fiberChannelAdapters": [ + { + "id": "fcs1", + "wwpn": "10000090fab674d7", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C2-T2", + "numOfPorts": 0, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "runningSpeed": [ + 0.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "id": "fcs0", + "wwpn": "10000090fab674d6", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C2-T1", + "numOfPorts": 3, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.400 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 26214.400 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 26214.400 + ] + } + ] + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/test/resources/processed-metrics-for-managed-system.xml b/src/test/resources/processed-metrics.xml similarity index 72% rename from src/test/resources/processed-metrics-for-managed-system.xml rename to src/test/resources/processed-metrics.xml index aabbc4f..78e5950 100644 --- a/src/test/resources/processed-metrics-for-managed-system.xml +++ b/src/test/resources/processed-metrics.xml @@ -1,26 +1,26 @@ b597e4da-2aab-3f52-8616-341d62153559 - 2020-08-06T22:28:00.000+02:00 + 2020-08-07T10:24:00.000+02:00 ProcessedMetrics ManagedSystem b597e4da-2aab-3f52-8616-341d62153559 - c6490306-f076-4ef4-92ce-5259a309db61 - 2020-08-06T22:28:00.000+02:00 - ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20200806T202900+0200_20200806T222800+0200_30.json - 2020-08-06T20:29:00.000+02:00 - + b92c34bf-2a98-4ead-b217-eb3dbd77850a + 2020-08-07T10:24:00.000+02:00 + ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20200807T082500+0200_20200807T102400+0200_30.json + 2020-08-07T08:25:00.000+02:00 + IBM Power Systems Management Console - 3f3f9a87-2afc-4848-aac1-3119cb294109 - 2020-08-06T22:28:57.020+02:00 + 979291f0-f4bc-40a6-915f-583ca15647a7 + 2020-08-07T10:24:50.094+02:00 LogicalPartition_44A89632-E9E6-4E12-91AF-1A33DEE060CF - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -28,10 +28,10 @@ - 8ea7e83f-643c-4b59-a2af-fddde7727082 - 2020-08-06T22:28:57.020+02:00 + c0b13428-d976-4767-a76c-01949216887b + 2020-08-07T10:24:50.094+02:00 LogicalPartition_6B7D14D3-BBD2-475B-8284-70FADBFC37FB - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -39,10 +39,10 @@ - a1045796-6070-429f-bb0d-a73199c6d04f - 2020-08-06T22:28:57.020+02:00 + 23dde466-eed0-4ddb-afe9-247b6d89299b + 2020-08-07T10:24:50.094+02:00 LogicalPartition_2A379B8A-C6E0-415E-9601-9832251F616F - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -50,10 +50,10 @@ - b0f0e742-b7f3-4f2a-bf71-a34fd12ba48b - 2020-08-06T22:28:57.020+02:00 + 4178976f-5e4b-456b-8d84-f497ae177296 + 2020-08-07T10:24:50.094+02:00 LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649 - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -61,10 +61,10 @@ - 244f78d1-bc27-4748-86cd-a9d7cdff6c4f - 2020-08-06T22:28:57.020+02:00 + 087df5fa-45c1-47fa-8198-36f756ea23ba + 2020-08-07T10:24:50.094+02:00 LogicalPartition_42108956-78CB-4040-A291-DF872B49268F - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -72,10 +72,10 @@ - d6b2b153-4de9-4546-b6e7-6e4fc4c97d56 - 2020-08-06T22:28:57.020+02:00 + 822d6e92-9937-4487-9010-cbf9c6ab5e6b + 2020-08-07T10:24:50.094+02:00 LogicalPartition_243A3A4C-85BF-4384-80E9-00954962B8CB - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -83,10 +83,10 @@ - 3512e881-82c1-4ffa-b975-689f79e82f90 - 2020-08-06T22:28:57.020+02:00 + f04ed37f-30e3-443a-8e2c-3a9bf838db46 + 2020-08-07T10:24:50.094+02:00 LogicalPartition_72A9CD86-312A-4A61-B9A3-2D5A11B373E5 - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -94,10 +94,10 @@ - e903468f-94a9-4ac8-a892-064414fd40b5 - 2020-08-06T22:28:57.020+02:00 + 4d2d4336-b3cb-47a6-b75d-b1f20927f8a5 + 2020-08-07T10:24:50.094+02:00 LogicalPartition_58215ABF-1C91-4932-96EA-88041D560EED - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -105,10 +105,10 @@ - 1eae063b-cc7f-4fc1-b245-bc03bcc3d53f - 2020-08-06T22:28:57.020+02:00 + b68eb9e1-8801-4686-8ba4-63e56c37c43c + 2020-08-07T10:24:50.094+02:00 LogicalPartition_6D775DB5-010B-4B7C-B585-BB7C9128D259 - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -116,10 +116,10 @@ - 17ce9f71-5f05-4c2b-8b42-28237b11eb87 - 2020-08-06T22:28:57.020+02:00 + c430b3ed-2216-4e99-a2e3-419fd08743a6 + 2020-08-07T10:24:50.094+02:00 LogicalPartition_75E900B0-06E2-4C67-A158-0198B4264304 - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -127,10 +127,10 @@ - 41e6f6b4-47d0-4a60-8273-dfc75d62107c - 2020-08-06T22:28:57.020+02:00 + 71dd6737-fa7d-489f-9c35-84bf3741673d + 2020-08-07T10:24:50.094+02:00 LogicalPartition_3380A831-9D22-4F03-A1DF-18B249F0FF8E - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console @@ -138,10 +138,10 @@ - 503ae682-db8b-4eea-8ac9-47baf25fd93d - 2020-08-06T22:28:57.020+02:00 + 53cbaa29-636c-4429-af94-199729de499e + 2020-08-07T10:24:50.094+02:00 LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82 - 2020-08-06T22:28:57.020+02:00 + 2020-08-07T10:24:50.094+02:00 IBM Power Systems Management Console