Refactoring work, replaced Groovy xml and json w. jsoup and moshi.

This commit is contained in:
Mark Nellemann 2020-10-09 16:32:16 +02:00
parent 6a1742e72a
commit 3f71aabd4e
52 changed files with 505 additions and 468 deletions

View File

@ -18,6 +18,10 @@ repositories {
dependencies {
implementation 'info.picocli:picocli:4.5.1'
annotationProcessor 'info.picocli:picocli-codegen:4.5.1'
// implementation 'com.thoughtworks.xstream:xstream:1.4.13'
// https://mvnrepository.com/artifact/org.jsoup/jsoup
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.squareup.moshi:moshi:1.11.0'
implementation 'org.tomlj:tomlj:1.0.0'
implementation 'org.codehaus.groovy:groovy-all:3.0.5'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
@ -25,6 +29,7 @@ dependencies {
implementation 'org.slf4j:slf4j-api:1.7.+'
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
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')

View File

@ -16,25 +16,21 @@
package biz.nellemann.hmci
import biz.nellemann.hmci.Configuration.HmcObject
import com.squareup.moshi.Moshi
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import groovy.xml.XmlSlurper
import okhttp3.MediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.*
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.select.Elements
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSession
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import javax.net.ssl.*
import java.security.SecureRandom
import java.security.cert.CertificateException
import java.security.cert.X509Certificate;
import java.security.cert.X509Certificate
@Slf4j
@CompileStatic
@ -154,11 +150,11 @@ class HmcClient {
*
* @return
*/
@CompileDynamic
//@CompileDynamic
Map<String, ManagedSystem> getManagedSystems() {
URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem", baseUrl))
Response response = getResponse(url)
String responseBody = response.body.string()
String responseBody = response.body().string()
Map<String,ManagedSystem> managedSystemsMap = new HashMap<String, ManagedSystem>()
// Do not try to parse empty response
@ -167,22 +163,24 @@ class HmcClient {
return managedSystemsMap
}
def feed = new XmlSlurper().parseText(responseBody)
feed?.entry?.each { entry ->
entry.content.each { content ->
content.ManagedSystem.each { system ->
ManagedSystem managedSystem = new ManagedSystem(
hmcId,
entry.id as String,
system.SystemName as String,
system.MachineTypeModelAndSerialNumber?.MachineType as String,
system.MachineTypeModelAndSerialNumber?.Model as String,
system.MachineTypeModelAndSerialNumber?.SerialNumber as String
)
managedSystemsMap.put(managedSystem.id, managedSystem)
log.debug("getManagedSystems() - Found system: " + managedSystem.toString())
}
try {
Document doc = Jsoup.parse(responseBody);
Elements managedSystems = doc.select("ManagedSystem|ManagedSystem") // doc.select("img[src$=.png]");
for(Element el : managedSystems) {
ManagedSystem system = new ManagedSystem(
hmcId,
el.select("Metadata > Atom > AtomID").text() as String,
el.select("SystemName").text() as String,
el.select("MachineTypeModelAndSerialNumber > MachineType").text() as String,
el.select("MachineTypeModelAndSerialNumber > Model").text() as String,
el.select("MachineTypeModelAndSerialNumber > SerialNumber").text() as String,
)
managedSystemsMap.put(system.id, system)
log.info("getManagedSystems() - Found system: " + system.toString())
}
} catch(Exception e) {
log.warn("getManagedSystems() - xml parse error", e);
}
return managedSystemsMap
@ -196,11 +194,11 @@ class HmcClient {
* @param UUID of managed system
* @return
*/
@CompileDynamic
//@CompileDynamic
Map<String, LogicalPartition> getLogicalPartitionsForManagedSystem(ManagedSystem system) {
URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id))
Response response = getResponse(url)
String responseBody = response.body.string()
String responseBody = response.body().string()
Map<String, LogicalPartition> partitionMap = new HashMap<String, LogicalPartition>() {}
// Do not try to parse empty response
@ -209,22 +207,22 @@ class HmcClient {
return partitionMap
}
def feed = new XmlSlurper().parseText(responseBody)
feed?.entry?.each { entry ->
//log.debug("Entry")
entry.content.each { content ->
//log.debug("Content")
content.LogicalPartition.each { partition ->
LogicalPartition logicalPartition = new LogicalPartition(
partition.PartitionUUID as String,
partition.PartitionName as String,
partition.PartitionType as String,
system
)
partitionMap.put(logicalPartition.id, logicalPartition)
log.debug("getLogicalPartitionsForManagedSystem() - Found partition: " + logicalPartition.toString())
}
try {
Document doc = Jsoup.parse(responseBody);
Elements logicalPartitions = doc.select("LogicalPartition|LogicalPartition") // doc.select("img[src$=.png]");
for(Element el : logicalPartitions) {
LogicalPartition logicalPartition = new LogicalPartition(
el.select("PartitionUUID").text() as String,
el.select("PartitionName").text() as String,
el.select("PartitionType").text() as String,
system
)
partitionMap.put(logicalPartition.id, logicalPartition)
log.info("getLogicalPartitionsForManagedSystem() - Found partition: " + logicalPartition.toString())
}
} catch(Exception e) {
log.warn("getLogicalPartitionsForManagedSystem() - xml parse error", e);
}
return partitionMap
@ -237,12 +235,12 @@ class HmcClient {
* @param systemId
* @return
*/
@CompileDynamic
//@CompileDynamic
String getPcmDataForManagedSystem(ManagedSystem system) {
log.debug("getPcmDataForManagedSystem() - " + system.id)
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()
String responseBody = response.body().string()
String jsonBody
// Do not try to parse empty response
@ -251,13 +249,17 @@ class HmcClient {
return jsonBody
}
// Parse XML and fetch JSON link
def feed = new XmlSlurper().parseText(responseBody)
feed?.entry?.each { entry ->
String link = entry.link["@href"]
if(entry.category["@term"] == "ManagedSystem") {
jsonBody = getResponseBody(new URL(link))
try {
Document doc = Jsoup.parse(responseBody);
Element entry = doc.select("entry").first();
Element link = entry.select("link[href]").first();
if(link.attr("type") == "application/json") {
String href = (String) link.attr("href");
log.debug("getPcmDataForManagedSystem() - json url: " + href);
jsonBody = getResponseBody(new URL(href));
}
} catch(Exception e) {
log.warn("getPcmDataForManagedSystem() - xml parse error", e);
}
return jsonBody
@ -270,13 +272,13 @@ class HmcClient {
* @param partitionId
* @return
*/
@CompileDynamic
//@CompileDynamic
String getPcmDataForLogicalPartition(LogicalPartition partition) {
log.debug(String.format("getPcmDataForLogicalPartition() - %s @ %s", partition.id, partition.system.id))
URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/LogicalPartition/%s/ProcessedMetrics?NoOfSamples=1", baseUrl, partition.system.id, partition.id))
Response response = getResponse(url)
String responseBody = response.body.string()
String responseBody = response.body().string()
String jsonBody
// Do not try to parse empty response
@ -285,13 +287,17 @@ class HmcClient {
return jsonBody
}
// Parse XML and fetch JSON link
def feed = new XmlSlurper().parseText(responseBody)
feed?.entry?.each { entry ->
String link = entry.link["@href"]
if(entry.category["@term"] == "LogicalPartition") {
jsonBody = getResponseBody(new URL(link))
try {
Document doc = Jsoup.parse(responseBody);
Element entry = doc.select("entry").first();
Element link = entry.select("link[href]").first();
if(link.attr("type") == "application/json") {
String href = (String) link.attr("href");
log.debug("getPcmDataForLogicalPartition() - json url: " + href);
jsonBody = getResponseBody(new URL(href));
}
} catch(Exception e) {
log.warn("getPcmDataForLogicalPartition() - xml parse error", e);
}
return jsonBody

View File

@ -52,9 +52,9 @@ class LogicalPartition extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getAffinityScore() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
affinityScore: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.affinityScore,
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getAffinityScore() - fields: " + fieldsMap.toString())
@ -77,10 +77,10 @@ class LogicalPartition extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
logicalMem: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.memory?.logicalMem?.first(),
backedPhysicalMem: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.memory?.backedPhysicalMem?.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString())
@ -103,7 +103,7 @@ class LogicalPartition extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> 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(),
@ -115,7 +115,7 @@ class LogicalPartition extends MetaSystem {
utilizedUncappedProcUnits: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.processor?.utilizedUncappedProcUnits?.first(),
timePerInstructionExecution: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.processor?.timeSpentWaitingForDispatch?.first(),
timeSpentWaitingForDispatch: metrics.systemUtil?.utilSamples?.first()?.lparsUtil?.first()?.processor?.timePerInstructionExecution?.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString())
@ -143,12 +143,12 @@ class LogicalPartition extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
receivedPhysicalBytes: it.receivedPhysicalBytes.first(),
sentPhysicalBytes: it.sentPhysicalBytes.first(),
receivedBytes: it.receivedBytes.first(),
sentBytes: it.sentBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap.toString())
@ -177,11 +177,11 @@ class LogicalPartition extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getVirtualFiberChannelAdaptersMetrics() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
transmittedBytes: it.transmittedBytes.first(),
writeBytes: it.writeBytes.first(),
readBytes: it.readBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getVirtualFiberChannelAdaptersMetrics() - fields: " + fieldsMap.toString())

View File

@ -58,12 +58,12 @@ class ManagedSystem extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString())
Map<String, BigDecimal> fieldsMap = [
Map<String, Number> fieldsMap = [
"totalMem": metrics.systemUtil?.utilSamples?.first()?.serverUtil?.memory?.totalMem?.first(),
"availableMem": metrics.systemUtil?.utilSamples?.first()?.serverUtil?.memory?.availableMem?.first(),
"configurableMem": metrics.systemUtil?.utilSamples?.first()?.serverUtil?.memory?.configurableMem?.first(),
"assignedMemToLpars": metrics.systemUtil?.utilSamples?.first()?.serverUtil?.memory?.assignedMemToLpars?.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString())
@ -88,12 +88,12 @@ class ManagedSystem extends MetaSystem {
//measurement.tags = tagsMap;
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
availableProcUnits: metrics.systemUtil?.utilSamples?.first()?.serverUtil?.processor?.totalProcUnits?.first(),
utilizedProcUnits: metrics.systemUtil?.utilSamples?.first()?.serverUtil?.processor?.utilizedProcUnits?.first(),
availableProcUnits: metrics.systemUtil?.utilSamples?.first()?.serverUtil?.processor?.availableProcUnits?.first(),
configurableProcUnits: metrics.systemUtil?.utilSamples?.first()?.serverUtil?.processor?.configurableProcUnits?.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
//measurement.fields = fieldsMap;
log.debug("getProcessorMetrics() - fields: " + fieldsMap.toString())
@ -119,10 +119,10 @@ class ManagedSystem extends MetaSystem {
//map.put("tags", tagsMap)
log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
assignedProcUnits: it.assignedProcUnits.first(),
availableProcUnits: it.availableProcUnits.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString())
@ -152,11 +152,11 @@ class ManagedSystem extends MetaSystem {
measurement.tags = tagsMap;
log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
sentBytes: it.sentBytes.first(),
receivedBytes: it.receivedBytes.first(),
transferredBytes: it.transferredBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemSharedAdapters() - fields: " + fieldsMap.toString())
@ -190,11 +190,11 @@ class ManagedSystem extends MetaSystem {
measurement.tags = tagsMap;
log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
writeBytes: it.writeBytes.first(),
readBytes: it.readBytes.first(),
transmittedBytes: it.transmittedBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemFiberChannelAdapters() - fields: " + fieldsMap.toString())
@ -225,11 +225,11 @@ class ManagedSystem extends MetaSystem {
measurement.tags = tagsMap;
log.debug("getSystemGenericPhysicalAdapters() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
writeBytes: it.writeBytes.first(),
readBytes: it.readBytes.first(),
transmittedBytes: it.transmittedBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemGenericPhysicalAdapters() - fields: " + fieldsMap.toString())
@ -260,11 +260,11 @@ class ManagedSystem extends MetaSystem {
measurement.tags = tagsMap;
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString())
HashMap<String, BigDecimal> fieldsMap = [
HashMap<String, Number> fieldsMap = [
writeBytes: it.writeBytes.first(),
readBytes: it.readBytes.first(),
transmittedBytes: it.transmittedBytes.first(),
]
] as HashMap<String, Number>
//map.put("fields", fieldsMap)
measurement.fields = fieldsMap;
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString())

View File

@ -16,8 +16,10 @@
package biz.nellemann.hmci
import biz.nellemann.hmci.pcm.PcmData
import groovy.json.JsonSlurper
import groovy.transform.CompileDynamic
import com.squareup.moshi.FromJson
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.ToJson
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@ -29,16 +31,36 @@ import java.time.format.DateTimeParseException
@CompileStatic
abstract class MetaSystem {
private final Moshi moshi;
private final JsonAdapter<PcmData> jsonAdapter;
protected PcmData metrics
@CompileDynamic
void processMetrics(String json) {
Map pcmMap = new JsonSlurper().parseText(json) as Map
metrics = new PcmData(pcmMap)
MetaSystem() {
try {
moshi = new Moshi.Builder().add(new NumberAdapter()).add(new BigDecimalAdapter())build();
jsonAdapter = moshi.adapter(PcmData.class);
} catch(Exception e) {
log.warn("MetaSystem() error", e)
throw new ExceptionInInitializerError(e);
}
}
@CompileDynamic
Instant getTimestamp() {
//@CompileDynamic
void processMetrics(String json) {
try {
metrics = jsonAdapter.fromJson(json);
} catch(Exception e) {
log.warn("processMetrics() error", e)
}
//Map pcmMap = new JsonSlurper().parseText(json) as Map
//metrics = new PcmData(pcmMap)
}
//@CompileDynamic
Instant getTimestamp() {
String timestamp = metrics.systemUtil.utilSamples.first().sampleInfo.timeStamp
Instant instant = null
@ -54,4 +76,32 @@ abstract class MetaSystem {
return instant ?: Instant.now()
}
class BigDecimalAdapter {
@FromJson
BigDecimal fromJson(String string) {
return new BigDecimal(string);
}
@ToJson
String toJson(BigDecimal value) {
return value.toString();
}
}
class NumberAdapter {
@FromJson
Number fromJson(String string) {
return new Double(string);
}
@ToJson
String toJson(Number value) {
return value.toString();
}
}
}

View File

@ -1,19 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class FiberChannelAdapter {
String id
String wwpn
String physicalLocation
Integer numOfPorts
List<BigDecimal> numOfReads
List<BigDecimal> numOfWrites
List<BigDecimal> readBytes
List<BigDecimal> writeBytes
List<BigDecimal> runningSpeed
List<BigDecimal> transmittedBytes
}

View File

@ -1,18 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class GenericAdapter {
String id
String type
String physicalLocation
List<BigDecimal> receivedPackets
List<BigDecimal> sentPackets
List<BigDecimal> droppedPackets
List<BigDecimal> sentBytes
List<BigDecimal> receivedBytes
List<BigDecimal> transferredBytes
}

View File

@ -1,17 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class GenericPhysicalAdapters {
String id
String type
String physicalLocation
List<BigDecimal> numOfReads
List<BigDecimal> numOfWrites
List<BigDecimal> readBytes
List<BigDecimal> writeBytes
List<BigDecimal> transmittedBytes
}

View File

@ -1,18 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class GenericVirtualAdapter {
String id
String type
Integer viosId
String physicalLocation
List<BigDecimal> numOfReads
List<BigDecimal> numOfWrites
List<BigDecimal> readBytes
List<BigDecimal> writeBytes
List<BigDecimal> transmittedBytes
}

View File

@ -1,11 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class LparMemory {
List<BigDecimal> logicalMem
List<BigDecimal> backedPhysicalMem
}

View File

@ -1,23 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class LparProcessor {
Integer poolId
Integer weight
String mode
List<BigDecimal> maxVirtualProcessors
List<BigDecimal> currentVirtualProcessors
List<BigDecimal> maxProcUnits
List<BigDecimal> entitledProcUnits
List<BigDecimal> utilizedProcUnits
List<BigDecimal> utilizedCappedProcUnits
List<BigDecimal> utilizedUncappedProcUnits
List<BigDecimal> idleProcUnits
List<BigDecimal> donatedProcUnits
List<BigDecimal> timeSpentWaitingForDispatch
List<BigDecimal> timePerInstructionExecution
}

View File

@ -1,21 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class LparUtil {
Integer id
String uuid
String name
String state
String type
String osType
Integer affinityScore
LparMemory memory
LparProcessor processor
Network network
Storage storage
}

View File

@ -1,10 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class Network {
List<GenericAdapter> genericAdapters
List<SharedAdapter> sharedAdapters
List<VirtualEthernetAdapter> virtualEthernetAdapters
}

View File

@ -1,10 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class PcmData {
SystemUtil systemUtil
}

View File

@ -1,14 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class PhysicalProcessorPool {
List<BigDecimal> assignedProcUnits
List<BigDecimal> utilizedProcUnits
List<BigDecimal> availableProcUnits
List<BigDecimal> configuredProcUnits
List<BigDecimal> borrowedProcUnits
}

View File

@ -1,11 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class SampleInfo {
String timeStamp
Integer status
}

View File

@ -1,13 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class ServerMemory {
List<BigDecimal> totalMem
List<BigDecimal> availableMem
List<BigDecimal> configurableMem
List<BigDecimal> assignedMemToLpars
}

View File

@ -1,13 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class ServerProcessor {
List<BigDecimal> totalProcUnits
List<BigDecimal> utilizedProcUnits
List<BigDecimal> availableProcUnits
List<BigDecimal> configurableProcUnits
}

View File

@ -1,13 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class ServerUtil {
ServerProcessor processor
ServerMemory memory
PhysicalProcessorPool physicalProcessorPool
List<SharedProcessorPool> sharedProcessorPool
}

View File

@ -1,19 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class SharedAdapter {
String id
String type
String physicalLocation
List<BigDecimal> receivedPackets
List<BigDecimal> sentPackets
List<BigDecimal> droppedPackets
List<BigDecimal> sentBytes
List<BigDecimal> receivedBytes
List<BigDecimal> transferredBytes
List<String> bridgedAdapters
}

View File

@ -1,16 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class SharedProcessorPool {
String id
String name
List<BigDecimal> assignedProcUnits
List<BigDecimal> utilizedProcUnits
List<BigDecimal> availableProcUnits
List<BigDecimal> configuredProcUnits
List<BigDecimal> borrowedProcUnits
}

View File

@ -1,14 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class Storage {
List<String> clientLpars
List<GenericPhysicalAdapters> genericPhysicalAdapters
List<GenericVirtualAdapter> genericVirtualAdapters
List<FiberChannelAdapter> fiberChannelAdapters
List<VirtualFiberChannelAdapter> virtualFiberChannelAdapters
}

View File

@ -1,11 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class SystemUtil {
UtilInfo utilInfo
List<UtilSample> utilSamples
}

View File

@ -1,18 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class UtilInfo {
String version
String metricType
Integer frequency
String startTimeStamp
String endTimeStamp
String mtms
String name
String uuid
List<String> metricArrayOrder
}

View File

@ -1,14 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class UtilSample {
String sampleType
SampleInfo sampleInfo
ServerUtil serverUtil
List<ViosUtil> viosUtil
List<LparUtil> lparsUtil
}

View File

@ -1,24 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class ViosUtil {
String id
String uuid
String name
String state
Integer affinityScore
Memory memory
LparProcessor processor
Network network
Storage storage
class Memory {
List<BigDecimal> assignedMem
List<BigDecimal> utilizedMem
}
}

View File

@ -1,27 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class VirtualEthernetAdapter {
String physicalLocation
Integer vlanId
Integer vswitchId
Boolean isPortVlanId
Integer viosId
String sharedEthernetAdapterId
List<BigDecimal> receivedPackets
List<BigDecimal> sentPackets
List<BigDecimal> droppedPackets
List<BigDecimal> sentBytes
List<BigDecimal> receivedBytes
List<BigDecimal> receivedPhysicalPackets
List<BigDecimal> sentPhysicalPackets
List<BigDecimal> droppedPhysicalPackets
List<BigDecimal> sentPhysicalBytes
List<BigDecimal> receivedPhysicalBytes
List<BigDecimal> transferredBytes
List<BigDecimal> transferredPhysicalBytes
}

View File

@ -1,20 +0,0 @@
package biz.nellemann.hmci.pcm
import groovy.transform.ToString
@ToString
class VirtualFiberChannelAdapter {
String wwpn
String wwpn2
String physicalLocation
String physicalPortWWPN
Integer viosId
List<BigDecimal> numOfReads
List<BigDecimal> numOfWrites
List<BigDecimal> readBytes
List<BigDecimal> writeBytes
List<BigDecimal> runningSpeed
List<BigDecimal> transmittedBytes
}

View File

@ -0,0 +1,18 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class FiberChannelAdapter {
String id;
String wwpn;
String physicalLocation;
Integer numOfPorts;
List<Number> numOfReads;
List<Number> numOfWrites;
List<Number> readBytes;
List<Number> writeBytes;
List<Number> runningSpeed;
List<Number> transmittedBytes;
}

View File

@ -0,0 +1,17 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class GenericAdapter {
String id;
String type;
String physicalLocation;
List<Number> receivedPackets;
List<Number> sentPackets;
List<Number> droppedPackets;
List<Number> sentBytes;
List<Number> receivedBytes;
List<Number> transferredBytes;
}

View File

@ -0,0 +1,16 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class GenericPhysicalAdapters {
String id;
String type;
String physicalLocation;
List<Number> numOfReads;
List<Number> numOfWrites;
List<Number> readBytes;
List<Number> writeBytes;
List<Number> transmittedBytes;
}

View File

@ -0,0 +1,17 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class GenericVirtualAdapter {
String id;
String type;
Integer viosId;
String physicalLocation;
List<Number> numOfReads;
List<Number> numOfWrites;
List<Number> readBytes;
List<Number> writeBytes;
List<Number> transmittedBytes;
}

View File

@ -0,0 +1,10 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class LparMemory {
List<Number> logicalMem;
List<Number> backedPhysicalMem;
}

View File

@ -0,0 +1,22 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class LparProcessor {
Integer poolId;
Integer weight;
String mode;
List<Number> maxVirtualProcessors;
List<Number> currentVirtualProcessors;
List<Number> maxProcUnits;
List<Number> entitledProcUnits;
List<Number> utilizedProcUnits;
List<Number> utilizedCappedProcUnits;
List<Number> utilizedUncappedProcUnits;
List<Number> idleProcUnits;
List<Number> donatedProcUnits;
List<Number> timeSpentWaitingForDispatch;
List<Number> timePerInstructionExecution;
}

View File

@ -0,0 +1,18 @@
package biz.nellemann.hmci.pcm;
public class LparUtil {
Integer id;
String uuid;
String name;
String state;
String type;
String osType;
Integer affinityScore;
LparMemory memory;
LparProcessor processor;
Network network;
Storage storage;
}

View File

@ -0,0 +1,11 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class Network {
List<GenericAdapter> genericAdapters;
List<SharedAdapter> sharedAdapters;
List<VirtualEthernetAdapter> virtualEthernetAdapters;
}

View File

@ -0,0 +1,7 @@
package biz.nellemann.hmci.pcm;
public class PcmData {
public SystemUtil systemUtil;
}

View File

@ -0,0 +1,13 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class PhysicalProcessorPool {
List<Number> assignedProcUnits;
List<Number> utilizedProcUnits;
List<Number> availableProcUnits;
List<Number> configuredProcUnits;
List<Number> borrowedProcUnits;
}

View File

@ -0,0 +1,8 @@
package biz.nellemann.hmci.pcm;
public class SampleInfo {
public String timeStamp;
Integer status;
}

View File

@ -0,0 +1,12 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class ServerMemory {
List<Number> totalMem;
List<Number> availableMem;
List<Number> configurableMem;
List<Number> assignedMemToLpars;
}

View File

@ -0,0 +1,12 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class ServerProcessor {
List<Number> totalProcUnits;
List<Number> utilizedProcUnits;
List<Number> availableProcUnits;
List<Number> configurableProcUnits;
}

View File

@ -0,0 +1,12 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class ServerUtil {
ServerProcessor processor;
ServerMemory memory;
PhysicalProcessorPool physicalProcessorPool;
List<SharedProcessorPool> sharedProcessorPool;
}

View File

@ -0,0 +1,18 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class SharedAdapter {
String id;
String type;
String physicalLocation;
List<Number> receivedPackets;
List<Number> sentPackets;
List<Number> droppedPackets;
List<Number> sentBytes;
List<Number> receivedBytes;
List<Number> transferredBytes;
List<String> bridgedAdapters;
}

View File

@ -0,0 +1,15 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class SharedProcessorPool {
String id;
String name;
List<Number> assignedProcUnits;
List<Number> utilizedProcUnits;
List<Number> availableProcUnits;
List<Number> configuredProcUnits;
List<Number> borrowedProcUnits;
}

View File

@ -0,0 +1,13 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class Storage {
List<String> clientLpars;
List<GenericPhysicalAdapters> genericPhysicalAdapters;
List<GenericVirtualAdapter> genericVirtualAdapters;
List<FiberChannelAdapter> fiberChannelAdapters;
List<VirtualFiberChannelAdapter> virtualFiberChannelAdapters;
}

View File

@ -0,0 +1,10 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class SystemUtil {
UtilInfo utilInfo;
public List<UtilSample> utilSamples;
}

View File

@ -0,0 +1,17 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class UtilInfo {
String version;
String metricType;
Integer frequency;
String startTimeStamp;
String endTimeStamp;
String mtms;
String name;
String uuid;
List<String> metricArrayOrder;
}

View File

@ -0,0 +1,13 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class UtilSample {
String sampleType;
public SampleInfo sampleInfo;
ServerUtil serverUtil;
List<ViosUtil> viosUtil;
List<LparUtil> lparsUtil;
}

View File

@ -0,0 +1,10 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class ViosMemory {
List<Number> assignedMem;
List<Number> utilizedMem;
}

View File

@ -0,0 +1,16 @@
package biz.nellemann.hmci.pcm;
public class ViosUtil {
String id;
String uuid;
String name;
String state;
Integer affinityScore;
ViosMemory memory;
LparProcessor processor;
Network network;
Storage storage;
}

View File

@ -0,0 +1,26 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class VirtualEthernetAdapter {
String physicalLocation;
Integer vlanId;
Integer vswitchId;
Boolean isPortVlanId;
Integer viosId;
String sharedEthernetAdapterId;
List<Number> receivedPackets;
List<Number> sentPackets;
List<Number> droppedPackets;
List<Number> sentBytes;
List<Number> receivedBytes;
List<Number> receivedPhysicalPackets;
List<Number> sentPhysicalPackets;
List<Number> droppedPhysicalPackets;
List<Number> sentPhysicalBytes;
List<Number> receivedPhysicalBytes;
List<Number> transferredBytes;
List<Number> transferredPhysicalBytes;
}

View File

@ -0,0 +1,19 @@
package biz.nellemann.hmci.pcm;
import java.util.List;
public class VirtualFiberChannelAdapter {
String wwpn;
String wwpn2;
String physicalLocation;
String physicalPortWWPN;
Integer viosId;
List<Number> numOfReads;
List<Number> numOfWrites;
List<Number> readBytes;
List<Number> writeBytes;
List<Number> runningSpeed;
List<Number> transmittedBytes;
}