From 930a1b982dc3fd19ad2af940795e871318da2396 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Thu, 24 Nov 2022 12:35:49 +0100 Subject: [PATCH] Major refactoring of xml+json deserialization. Initial work for optionally moving hmc specific code into it's own library. --- CHANGELOG.md | 4 +- README.md | 29 +- bitbucket-pipelines.yml | 2 +- build.gradle | 28 +- doc/hmci.toml | 18 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/biz/nellemann/hmci/Application.java | 35 +- .../biz/nellemann/hmci/Configuration.java | 268 -- .../java/biz/nellemann/hmci/HmcInstance.java | 337 -- .../biz/nellemann/hmci/HmcRestClient.java | 545 --- .../java/biz/nellemann/hmci/InfluxClient.java | 327 +- .../biz/nellemann/hmci/LogicalPartition.java | 432 +- .../biz/nellemann/hmci/ManagedSystem.java | 906 ++-- .../biz/nellemann/hmci/ManagementConsole.java | 261 ++ .../java/biz/nellemann/hmci/MetaSystem.java | 133 - .../java/biz/nellemann/hmci/Resource.java | 64 + .../java/biz/nellemann/hmci/RestClient.java | 295 ++ .../java/biz/nellemann/hmci/SystemEnergy.java | 157 +- .../biz/nellemann/hmci/VirtualIOServer.java | 66 + .../nellemann/hmci/dto/json/EnergyUtil.java | 8 + .../hmci/dto/json/FiberChannelAdapter.java | 22 + .../hmci/dto/json/GenericAdapter.java | 16 + .../dto/json/GenericPhysicalAdapters.java | 15 + .../hmci/dto/json/GenericVirtualAdapter.java | 22 + .../nellemann/hmci/dto/json/LparMemory.java | 12 + .../hmci/dto/json/LparProcessor.java | 21 + .../hmci/{pcm => dto/json}/LparUtil.java | 7 +- .../biz/nellemann/hmci/dto/json/Network.java | 16 + .../hmci/dto/json/PhysicalProcessorPool.java | 12 + .../nellemann/hmci/dto/json/PowerUtil.java | 7 + .../hmci/dto/json/ProcessedMetrics.java | 7 + .../nellemann/hmci/dto/json/SRIOVAdapter.java | 11 + .../hmci/dto/json/SRIOVLogicalPort.java | 21 + .../json/SRIOVPhysicalPort.java} | 30 +- .../nellemann/hmci/dto/json/SampleInfo.java | 29 + .../nellemann/hmci/dto/json/ServerMemory.java | 11 + .../hmci/dto/json/ServerProcessor.java | 10 + .../nellemann/hmci/dto/json/ServerUtil.java | 15 + .../hmci/dto/json/SharedAdapter.java | 25 + .../hmci/dto/json/SharedProcessorPool.java | 15 + .../biz/nellemann/hmci/dto/json/Storage.java | 15 + .../hmci/dto/json/SystemFirmware.java | 14 + .../nellemann/hmci/dto/json/SystemUtil.java | 24 + .../hmci/{pcm => dto/json}/Temperature.java | 6 +- .../nellemann/hmci/dto/json/ThermalUtil.java | 12 + .../hmci/{pcm => dto/json}/UtilInfo.java | 8 +- .../nellemann/hmci/dto/json/UtilSample.java | 30 + .../nellemann/hmci/dto/json/ViosMemory.java | 7 + .../hmci/{pcm => dto/json}/ViosUtil.java | 6 +- .../hmci/dto/json/VirtualEthernetAdapter.java | 30 + .../dto/json/VirtualFiberChannelAdapter.java | 23 + .../hmci/dto/toml/Configuration.java | 12 + .../hmci/dto/toml/HmcConfiguration.java | 28 + .../hmci/dto/toml/InfluxConfiguration.java | 17 + .../nellemann/hmci/dto/xml/IFixDetail.java | 16 + .../java/biz/nellemann/hmci/dto/xml/Link.java | 29 + .../hmci/dto/xml/LogicalPartitionEntry.java | 52 + .../nellemann/hmci/dto/xml/LogonResponse.java | 21 + .../xml/MachineTypeModelAndSerialNumber.java | 34 + .../hmci/dto/xml/ManagedSystemEntry.java | 94 + .../hmci/dto/xml/ManagementConsoleEntry.java | 99 + .../nellemann/hmci/dto/xml/ResourceEntry.java | 6 + .../nellemann/hmci/dto/xml/VersionInfo.java | 32 + .../hmci/dto/xml/VirtualIOServerEntry.java | 26 + .../biz/nellemann/hmci/dto/xml/XmlEntry.java | 97 + .../biz/nellemann/hmci/dto/xml/XmlFeed.java | 35 + .../biz/nellemann/hmci/pcm/EnergyUtil.java | 6 - .../hmci/pcm/FiberChannelAdapter.java | 30 - .../nellemann/hmci/pcm/GenericAdapter.java | 29 - .../hmci/pcm/GenericPhysicalAdapters.java | 26 - .../hmci/pcm/GenericVirtualAdapter.java | 28 - .../biz/nellemann/hmci/pcm/LparMemory.java | 16 - .../biz/nellemann/hmci/pcm/LparProcessor.java | 44 - .../java/biz/nellemann/hmci/pcm/Network.java | 15 - .../java/biz/nellemann/hmci/pcm/PcmData.java | 7 - .../hmci/pcm/PhysicalProcessorPool.java | 22 - .../biz/nellemann/hmci/pcm/PowerUtil.java | 11 - .../biz/nellemann/hmci/pcm/SampleInfo.java | 8 - .../biz/nellemann/hmci/pcm/ServerMemory.java | 22 - .../nellemann/hmci/pcm/ServerProcessor.java | 19 - .../biz/nellemann/hmci/pcm/ServerUtil.java | 13 - .../biz/nellemann/hmci/pcm/SharedAdapter.java | 32 - .../hmci/pcm/SharedProcessorPool.java | 25 - .../java/biz/nellemann/hmci/pcm/Storage.java | 14 - .../nellemann/hmci/pcm/SystemFirmware.java | 13 - .../biz/nellemann/hmci/pcm/SystemUtil.java | 14 - .../biz/nellemann/hmci/pcm/ThermalUtil.java | 12 - .../biz/nellemann/hmci/pcm/UtilSample.java | 20 - .../biz/nellemann/hmci/pcm/ViosMemory.java | 13 - .../hmci/pcm/VirtualEthernetAdapter.java | 51 - .../hmci/pcm/VirtualFiberChannelAdapter.java | 31 - .../nellemann/hmci/ConfigurationTest.groovy | 53 +- .../nellemann/hmci/HmcRestClientTest.groovy | 102 - .../nellemann/hmci/InfluxClientTest.groovy | 3 +- .../hmci/LogicalPartitionTest.groovy | 187 +- .../hmci/ManagedSystemEntryTest.groovy | 28 + .../nellemann/hmci/ManagedSystemTest.groovy | 308 +- .../hmci/ManagementConsoleEntryTest.groovy | 60 + .../biz/nellemann/hmci/MetaSystemTest.groovy | 24 - .../biz/nellemann/hmci/MockResponses.groovy | 103 + .../biz/nellemann/hmci/RestClientTest.groovy | 150 + .../nellemann/hmci/SystemEnergyTest.groovy | 62 - src/test/resources/1-hmc.xml | 159 + src/test/resources/2-managed-system-2.xml | 4124 +++++++++++++++++ .../resources/2-managed-system-perf-data.json | 805 ++++ .../2-managed-system-perf-data2.json | 1273 +++++ .../resources/2-managed-system-perf-feed.xml | 206 + src/test/resources/2-managed-system.xml | 2804 +++++++++++ src/test/resources/2-vios.xml | 3138 +++++++++++++ .../3-logical-partition-perf-data.json | 274 ++ src/test/resources/3-lpar.xml | 200 + .../4-managed-system-emergy-perf-data.json | 104 + .../resources/4-managed-system-energy.xml | 19 + src/test/resources/hmc-logon-request.xml | 5 + src/test/resources/hmc-logon-response.xml | 7 + src/test/resources/hmci.toml | 31 +- 117 files changed, 16476 insertions(+), 3290 deletions(-) delete mode 100644 src/main/java/biz/nellemann/hmci/Configuration.java delete mode 100644 src/main/java/biz/nellemann/hmci/HmcInstance.java delete mode 100644 src/main/java/biz/nellemann/hmci/HmcRestClient.java create mode 100644 src/main/java/biz/nellemann/hmci/ManagementConsole.java delete mode 100644 src/main/java/biz/nellemann/hmci/MetaSystem.java create mode 100644 src/main/java/biz/nellemann/hmci/Resource.java create mode 100644 src/main/java/biz/nellemann/hmci/RestClient.java create mode 100644 src/main/java/biz/nellemann/hmci/VirtualIOServer.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/EnergyUtil.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/FiberChannelAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/GenericAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/GenericPhysicalAdapters.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/GenericVirtualAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/LparMemory.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/LparProcessor.java rename src/main/java/biz/nellemann/hmci/{pcm => dto/json}/LparUtil.java (70%) create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/Network.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/PhysicalProcessorPool.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/PowerUtil.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ProcessedMetrics.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SRIOVAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SRIOVLogicalPort.java rename src/main/java/biz/nellemann/hmci/{pcm/SriovLogicalPort.java => dto/json/SRIOVPhysicalPort.java} (66%) create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SampleInfo.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ServerMemory.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ServerProcessor.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ServerUtil.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SharedAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SharedProcessorPool.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/Storage.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SystemFirmware.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/SystemUtil.java rename src/main/java/biz/nellemann/hmci/{pcm => dto/json}/Temperature.java (60%) create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ThermalUtil.java rename src/main/java/biz/nellemann/hmci/{pcm => dto/json}/UtilInfo.java (67%) create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/UtilSample.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/ViosMemory.java rename src/main/java/biz/nellemann/hmci/{pcm => dto/json}/ViosUtil.java (80%) create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/VirtualEthernetAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/json/VirtualFiberChannelAdapter.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/toml/Configuration.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/toml/HmcConfiguration.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/toml/InfluxConfiguration.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/IFixDetail.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/Link.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/LogicalPartitionEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/LogonResponse.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/MachineTypeModelAndSerialNumber.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/ManagedSystemEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/ManagementConsoleEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/ResourceEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/VersionInfo.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/VirtualIOServerEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/XmlEntry.java create mode 100644 src/main/java/biz/nellemann/hmci/dto/xml/XmlFeed.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/EnergyUtil.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/FiberChannelAdapter.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/GenericAdapter.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/GenericPhysicalAdapters.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/GenericVirtualAdapter.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/LparMemory.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/LparProcessor.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/Network.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/PcmData.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/PhysicalProcessorPool.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/PowerUtil.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/SampleInfo.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/ServerMemory.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/ServerProcessor.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/ServerUtil.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/SharedAdapter.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/SharedProcessorPool.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/Storage.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/SystemFirmware.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/SystemUtil.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/ThermalUtil.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/UtilSample.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/ViosMemory.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/VirtualEthernetAdapter.java delete mode 100644 src/main/java/biz/nellemann/hmci/pcm/VirtualFiberChannelAdapter.java delete mode 100644 src/test/groovy/biz/nellemann/hmci/HmcRestClientTest.groovy create mode 100644 src/test/groovy/biz/nellemann/hmci/ManagedSystemEntryTest.groovy create mode 100644 src/test/groovy/biz/nellemann/hmci/ManagementConsoleEntryTest.groovy delete mode 100644 src/test/groovy/biz/nellemann/hmci/MetaSystemTest.groovy create mode 100644 src/test/groovy/biz/nellemann/hmci/MockResponses.groovy create mode 100644 src/test/groovy/biz/nellemann/hmci/RestClientTest.groovy delete mode 100644 src/test/groovy/biz/nellemann/hmci/SystemEnergyTest.groovy create mode 100644 src/test/resources/1-hmc.xml create mode 100644 src/test/resources/2-managed-system-2.xml create mode 100644 src/test/resources/2-managed-system-perf-data.json create mode 100644 src/test/resources/2-managed-system-perf-data2.json create mode 100644 src/test/resources/2-managed-system-perf-feed.xml create mode 100644 src/test/resources/2-managed-system.xml create mode 100644 src/test/resources/2-vios.xml create mode 100644 src/test/resources/3-logical-partition-perf-data.json create mode 100644 src/test/resources/3-lpar.xml create mode 100644 src/test/resources/4-managed-system-emergy-perf-data.json create mode 100644 src/test/resources/4-managed-system-energy.xml create mode 100644 src/test/resources/hmc-logon-request.xml create mode 100644 src/test/resources/hmc-logon-response.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index e06dcd4..2fd3acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ All notable changes to this project will be documented in this file. +## [1.3.5] - 2022-11-08 + ## [1.3.4] - 2022-10-24 ### Changed - Updated 3rd party dependencies - ## [1.3.3] - 2022-09-20 ### Added - Default configuration location on Windows platform. @@ -28,6 +29,7 @@ All notable changes to this project will be documented in this file. ### Added - Options to include/exclude Managed Systems and/or Logical Partitions. +[1.3.5]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.5%0Dv1.3.4 [1.3.4]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.4%0Dv1.3.3 [1.3.3]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.3%0Dv1.3.0 [1.3.0]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.0%0Dv1.2.8 diff --git a/README.md b/README.md index bba0b60..bf29e7b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Metrics includes: - *Managed Systems* - the physical Power servers - *Logical Partitions* - the virtualized servers running AIX, Linux or IBM-i (AS/400) - *Virtual I/O Servers* - the i/o partition(s) virtualizing network and storage - - *Energy* - power consumption and temperatures (needs to be enabled and is not available on P7 and multi-chassis systems) + - *Energy* - watts and temperatures (needs to be enabled and is not available on P7 and multi-chassis systems) ![architecture](doc/HMCi.png) @@ -33,8 +33,11 @@ There are few steps in the installation. - Navigate to *Users and Security* - Create a new read-only/viewer **hmci** user, which will be used to connect to the HMC. - Click *Manage User Profiles and Access*, edit the newly created *hmci* user and click *User Properties*: - - **Enable** *Allow remote access via the web* + - Set *Session timeout minutes* to **60** + - Set *Verify timeout minutes* to **15** + - Set *Idle timeout minutes* to **90** - Set *Minimum time in days between password changes* to **0** + - **Enable** *Allow remote access via the web* - Navigate to *HMC Management* and *Console Settings* - Click *Change Performance Monitoring Settings*: - Enable *Performance Monitoring Data Collection for Managed Servers*: **All On** @@ -63,17 +66,17 @@ Install *HMCi* on a host, that can connect to your Power HMC (on port 12443), an - Ensure you have **correct date/time** and NTPd running to keep it accurate! - The only requirement for **hmci** is the Java runtime, version 8 (or later) - Install **HMCi** from [downloads](https://bitbucket.org/mnellemann/hmci/downloads/) (rpm, deb or jar) or build from source - - On RPM based systems: **sudo rpm -i hmci-x.y.z-n.noarch.rpm** - - On DEB based systems: **sudo dpkg -i hmci_x.y.z-n_all.deb** + - On RPM based systems: ```sudo rpm -ivh hmci-x.y.z-n.noarch.rpm``` + - On DEB based systems: ```sudo dpkg -i hmci_x.y.z-n_all.deb``` - Copy the **/opt/hmci/doc/hmci.toml** configuration example into **/etc/hmci.toml** and edit the configuration to suit your environment. The location of the configuration file can optionally be changed with the *--conf* option. - Run the **/opt/hmci/bin/hmci** program in a shell, as a @reboot cron task or configure as a proper service - there are instructions in the [doc/readme-service.md](doc/readme-service.md) file. -- When started, *hmci* expects the InfluxDB database to be created by you. +- When started, *hmci* expects the InfluxDB database to exist already. ### 4 - Grafana Configuration - Configure Grafana to use InfluxDB as a new datasource - **NOTE:** set *Min time interval* to *30s* or *1m* depending on your HMCi *refresh* setting. -- Import example dashboards from [doc/dashboards/*.json](doc/dashboards/) into Grafana as a starting point and get creative making your own cool dashboards :) +- Import example dashboards from [doc/dashboards/*.json](doc/dashboards/) into Grafana as a starting point and get creative making your own cool dashboards - please share anything useful :) ## Notes @@ -188,30 +191,30 @@ Use the gradle build tool, which will download all required dependencies: ### Local Testing -#### InfluxDB container +#### InfluxDB Start the InfluxDB container: ```shell -docker run --name=influxdb --rm -d -p 8086:8086 influxdb:1.8-alpine +docker run --name=influxdb --rm -d -p 8086:8086 influxdb:1.8 ``` -To execute the Influx client from within the container: +Create the *hmci* database: ```shell -docker exec -it influxdb influx +docker exec -i influxdb influx -execute "CREATE DATABASE hmci" ``` -#### Grafana container + +#### Grafana Start the Grafana container, linking it to the InfluxDB container: ```shell -docker run --name grafana --link influxdb:influxdb --rm -d -p 3000:3000 grafana/grafana:7.1.3 +docker run --name grafana --link influxdb:influxdb --rm -d -p 3000:3000 grafana/grafana ``` Setup Grafana to connect to the InfluxDB container by defining a new datasource on URL *http://influxdb:8086* named *hmci*. -The hmci database must be created beforehand, which can be done by running the hmci tool first. Grafana dashboards can be imported from the *doc/* folder. diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 7c2cc8b..d9a134a 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,4 +1,4 @@ -image: openjdk:8 +image: eclipse-temurin:8-jdk pipelines: branches: diff --git a/build.gradle b/build.gradle index 707b0f1..5984fef 100644 --- a/build.gradle +++ b/build.gradle @@ -20,25 +20,26 @@ group = projectGroup version = projectVersion dependencies { - annotationProcessor 'info.picocli:picocli-codegen:4.6.3' - implementation 'info.picocli:picocli:4.6.3' - implementation 'org.jsoup:jsoup:1.15.3' - implementation 'com.squareup.okhttp3:okhttp:4.10.0' - implementation 'com.squareup.moshi:moshi:1.14.0' - implementation 'com.serjltt.moshi:moshi-lazy-adapters:2.2' - implementation 'org.tomlj:tomlj:1.1.0' + annotationProcessor 'info.picocli:picocli-codegen:4.7.0' + implementation 'info.picocli:picocli:4.7.0' implementation 'org.influxdb:influxdb-java:2.23' - implementation 'org.slf4j:slf4j-api:2.0.3' - implementation 'org.slf4j:slf4j-simple:2.0.3' + //implementation 'com.influxdb:influxdb-client-java:6.7.0' + implementation 'org.slf4j:slf4j-api:2.0.4' + implementation 'org.slf4j:slf4j-simple:2.0.4' + implementation 'com.squareup.okhttp3:okhttp:4.10.0' // Also used by InfluxDB Client + //implementation "org.eclipse.jetty:jetty-client:9.4.49.v20220914" + implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.1' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.14.1' + testImplementation 'junit:junit:4.13.2' testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0' - testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0' - testImplementation 'org.slf4j:slf4j-simple:2.0.3' + testImplementation "org.mock-server:mockserver-netty-no-dependencies:5.14.0" } application { mainClass.set('biz.nellemann.hmci.Application') - applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+UseG1GC" ] + applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+UseG1GC", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ] } java { @@ -50,6 +51,7 @@ test { useJUnitPlatform() } + apply plugin: 'nebula.ospackage' ospackage { packageName = 'hmci' @@ -104,7 +106,7 @@ jacocoTestCoverageVerification { violationRules { rule { limit { - minimum = 0.5 + minimum = 0.4 } } } diff --git a/doc/hmci.toml b/doc/hmci.toml index 9427886..cc947e9 100644 --- a/doc/hmci.toml +++ b/doc/hmci.toml @@ -1,16 +1,6 @@ # HMCi Configuration # Copy this file into /etc/hmci.toml and customize it to your environment. -### -### General HMCi Settings -### - -# How often to query HMC's for data - in seconds -hmci.update = 30 - -# Rescan HMC's for new systems and partitions - every x update -hmci.rescan = 120 - ### ### Define one InfluxDB to save metrics into @@ -34,15 +24,17 @@ database = "hmci" url = "https://10.10.10.10:12443" username = "hmci" password = "hmcihmci" -unsafe = true # Ignore SSL cert. errors +refresh = 30 # How often to query HMC for data - in seconds +discover = 120 # Rescan HMC for new systems and partitions - in minutes +trust = true # Ignore SSL cert. errors (due to default self-signed cert. on HMC) +energy = true # Collect energy metrics on supported systems + # Another HMC example #[hmc.site2] #url = "https://10.10.10.30:12443" #username = "user" #password = "password" -#unsafe = false # When false, validate SSL/TLS cerfificate, default is true -#energy = false # When false, do not collect energy metrics, default is true #trace = "/tmp/hmci-trace" # When present, store JSON metrics files from HMC into this folder #excludeSystems = [ 'notThisSystem' ] # Collect metrics from all systems except those listed here #includeSystems = [ 'onlyThisSystems' ] # Collcet metrics from no systems but those listed here diff --git a/gradle.properties b/gradle.properties index 3afee7e..d04555e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ projectId = hmci projectGroup = biz.nellemann.hmci -projectVersion = 1.3.4 +projectVersion = 1.4.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/biz/nellemann/hmci/Application.java b/src/main/java/biz/nellemann/hmci/Application.java index b52da8b..659e650 100644 --- a/src/main/java/biz/nellemann/hmci/Application.java +++ b/src/main/java/biz/nellemann/hmci/Application.java @@ -15,12 +15,13 @@ */ package biz.nellemann.hmci; +import biz.nellemann.hmci.dto.toml.Configuration; +import com.fasterxml.jackson.dataformat.toml.TomlMapper; import picocli.CommandLine; import picocli.CommandLine.Option; import picocli.CommandLine.Command; import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @@ -45,9 +46,8 @@ public class Application implements Callable { @Override - public Integer call() throws IOException { + public Integer call() { - Configuration configuration; InfluxClient influxClient; List threadList = new ArrayList<>(); @@ -66,22 +66,39 @@ public class Application implements Callable { } try { - configuration = new Configuration(configurationFile.toPath()); - influxClient = new InfluxClient(configuration.getInflux()); + TomlMapper mapper = new TomlMapper(); + Configuration configuration = mapper.readerFor(Configuration.class) + .readValue(configurationFile); + + influxClient = new InfluxClient(configuration.influx); influxClient.login(); - for(Configuration.HmcObject configHmc : configuration.getHmc()) { - Thread t = new Thread(new HmcInstance(configHmc, influxClient)); + configuration.hmc.forEach((key, value) -> { + try { + ManagementConsole managementConsole = new ManagementConsole(value, influxClient); + Thread t = new Thread(managementConsole); + t.setName(key); + t.start(); + threadList.add(t); + } catch (Exception e) { + System.err.println(e.getMessage()); + } + }); + + /* + for(Configuration.HmcConfiguration configHmc : configuration.getHmc()) { + Thread t = new Thread(new ManagementConsole(configHmc, influxClient)); t.setName(configHmc.name); t.start(); threadList.add(t); - } + }*/ for (Thread thread : threadList) { thread.join(); } - } catch (InterruptedException | RuntimeException e) { + influxClient.logoff(); + } catch (Exception e) { System.err.println(e.getMessage()); return 1; } diff --git a/src/main/java/biz/nellemann/hmci/Configuration.java b/src/main/java/biz/nellemann/hmci/Configuration.java deleted file mode 100644 index 06e75eb..0000000 --- a/src/main/java/biz/nellemann/hmci/Configuration.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2020 Mark Nellemann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package biz.nellemann.hmci; - -import org.tomlj.Toml; -import org.tomlj.TomlParseResult; -import org.tomlj.TomlTable; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -public final class Configuration { - - final private Long update; - final private Long rescan; - - final private InfluxObject influx; - final private List hmcList; - - Configuration(Path configurationFile) throws IOException { - - TomlParseResult result = Toml.parse(configurationFile); - result.errors().forEach(error -> System.err.println(error.toString())); - - if(result.contains("hmci.update")) { - update = result.getLong("hmci.update"); - } else { - update = 30L; - } - - if(result.contains("hmci.rescan")) { - rescan = result.getLong("hmci.rescan"); - } else { - rescan = 60L; - } - - hmcList = parseConfigurationForHmc(result); - influx = parseConfigurationForInflux(result); - - } - - - private List parseConfigurationForHmc(TomlParseResult result) { - - ArrayList list = new ArrayList<>(); - - if(result.contains("hmc") && result.isTable("hmc")) { - TomlTable hmcTable = result.getTable("hmc"); - if(hmcTable == null) { - return list; - } - for(String key : hmcTable.keySet()) { - - HmcObject c = new HmcObject(); - c.name = key; - c.update = update; - c.rescan = rescan; - - if(hmcTable.contains(key+".url")) { - c.url = hmcTable.getString(key+".url"); - } - - if(hmcTable.contains(key+".username")) { - c.username = hmcTable.getString(key+".username"); - } - - if(hmcTable.contains(key+".password")) { - c.password = hmcTable.getString(key+".password"); - } - - if(hmcTable.contains(key+".unsafe")) { - c.unsafe = hmcTable.getBoolean(key+".unsafe"); - } else { - c.unsafe = false; - } - - if(hmcTable.contains(key+".energy")) { - c.energy = hmcTable.getBoolean(key+".energy"); - } else { - c.energy = true; - } - - if(hmcTable.contains(key+".trace")) { - c.trace = hmcTable.getString(key+".trace"); - } else { - c.trace = null; - } - - if(hmcTable.contains(key+".excludeSystems")) { - List tmpList = hmcTable.getArrayOrEmpty(key+".excludeSystems").toList(); - c.excludeSystems = tmpList.stream() - .map(object -> Objects.toString(object, null)) - .collect(Collectors.toList()); - } else { - c.excludeSystems = new ArrayList<>(); - } - - if(hmcTable.contains(key+".includeSystems")) { - List tmpList = hmcTable.getArrayOrEmpty(key+".includeSystems").toList(); - c.includeSystems = tmpList.stream() - .map(object -> Objects.toString(object, null)) - .collect(Collectors.toList()); - } else { - c.includeSystems = new ArrayList<>(); - } - - if(hmcTable.contains(key+".excludePartitions")) { - List tmpList = hmcTable.getArrayOrEmpty(key+".excludePartitions").toList(); - c.excludePartitions = tmpList.stream() - .map(object -> Objects.toString(object, null)) - .collect(Collectors.toList()); - } else { - c.excludePartitions = new ArrayList<>(); - } - - if(hmcTable.contains(key+".includePartitions")) { - List tmpList = hmcTable.getArrayOrEmpty(key+".includePartitions").toList(); - c.includePartitions = tmpList.stream() - .map(object -> Objects.toString(object, null)) - .collect(Collectors.toList()); - } else { - c.includePartitions = new ArrayList<>(); - } - - list.add(c); - } - } - - return list; - } - - - private InfluxObject parseConfigurationForInflux(TomlParseResult result) { - - InfluxObject c = new InfluxObject(); - - if(result.contains("influx")) { - TomlTable t = result.getTable("influx"); - - if(t != null && t.contains("url")) { - c.url = t.getString("url"); - } - - if(t != null && t.contains("username")) { - c.username = t.getString("username"); - } - - if(t != null && t.contains("password")) { - c.password = t.getString("password"); - } - - if(t != null && t.contains("database")) { - c.database = t.getString("database"); - } - - } - - return c; - } - - - public List getHmc() { - return hmcList; - } - - - public InfluxObject getInflux() { - return influx; - } - - - static class InfluxObject { - - String url = "http://localhost:8086"; - String username = "root"; - String password = ""; - String database = "hmci"; - - private boolean validated = false; - - InfluxObject() { } - - InfluxObject(String url, String username, String password, String database) { - this.url = url; - this.username = username; - this.password = password; - this.database = database; - } - - Boolean isValid() { - return validated; - } - - // TODO: Implement validation - void validate() { - validated = true; - } - - @Override - public String toString() { - return url; - } - } - - - static class HmcObject { - - String name; - String url; - String username; - String password; - Boolean unsafe = false; - Boolean energy = true; - String trace; - List excludeSystems; - List includeSystems; - List excludePartitions; - List includePartitions; - Long update = 30L; - Long rescan = 60L; - - private boolean validated = false; - - HmcObject() { } - - HmcObject(String name, String url, String username, String password, Boolean unsafe, Long update, Long rescan) { - this.url = url; - this.username = username; - this.password = password; - this.unsafe = unsafe; - this.update = update; - this.rescan = rescan; - } - - - Boolean isValid() { - return validated; - } - - // TODO: Implement validation - void validate() { - validated = true; - } - - @Override - public String toString() { - return name; - } - } - -} diff --git a/src/main/java/biz/nellemann/hmci/HmcInstance.java b/src/main/java/biz/nellemann/hmci/HmcInstance.java deleted file mode 100644 index 70d18f7..0000000 --- a/src/main/java/biz/nellemann/hmci/HmcInstance.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright 2020 Mark Nellemann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package biz.nellemann.hmci; - -import biz.nellemann.hmci.Configuration.HmcObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import static java.lang.Thread.sleep; - -class HmcInstance implements Runnable { - - private final static Logger log = LoggerFactory.getLogger(HmcInstance.class); - - private final String hmcId; - private final Long updateValue; - private final Long rescanValue; - private final Map systems = new HashMap<>(); - private final Map partitions = new HashMap<>(); - - private final HmcRestClient hmcRestClient; - private final InfluxClient influxClient; - private final AtomicBoolean keepRunning = new AtomicBoolean(true); - - private File traceDir; - private Boolean doTrace = false; - private Boolean doEnergy = true; - private List excludeSystems; - private List includeSystems; - private List excludePartitions; - private List includePartitions; - - HmcInstance(HmcObject configHmc, InfluxClient influxClient) { - this.hmcId = configHmc.name; - this.updateValue = configHmc.update; - this.rescanValue = configHmc.rescan; - this.doEnergy = configHmc.energy; - this.influxClient = influxClient; - hmcRestClient = new HmcRestClient(configHmc.url, configHmc.username, configHmc.password, configHmc.unsafe); - log.debug("HmcInstance() - id: {}, update: {}, refresh {}", hmcId, updateValue, rescanValue); - - if(configHmc.trace != null) { - try { - traceDir = new File(configHmc.trace); - traceDir.mkdirs(); - if(traceDir.canWrite()) { - doTrace = true; - } else { - log.warn("HmcInstance() - can't write to trace dir: " + traceDir.toString()); - } - } catch (Exception e) { - log.error("HmcInstance() - trace error: " + e.getMessage()); - } - } - this.excludeSystems = configHmc.excludeSystems; - this.includeSystems = configHmc.includeSystems; - this.excludePartitions = configHmc.excludePartitions; - this.includePartitions = configHmc.includePartitions; - } - - - @Override - public String toString() { - return hmcId; - } - - - @Override - public void run() { - - log.trace("run() - " + hmcId); - int executions = 0; - - discover(); - - do { - Instant instantStart = Instant.now(); - try { - if (doEnergy) { - getMetricsForEnergy(); - } - getMetricsForSystems(); - getMetricsForPartitions(); - - writeMetricsForSystemEnergy(); - writeMetricsForManagedSystems(); - writeMetricsForLogicalPartitions(); - //influxClient.writeBatchPoints(); - - // Refresh - if (++executions > rescanValue) { - executions = 0; - discover(); - } - } catch (Exception e) { - log.error("run() - fatal error: {}", e.getMessage()); - keepRunning.set(false); - throw new RuntimeException(e); - } - - Instant instantEnd = Instant.now(); - long timeSpend = Duration.between(instantStart, instantEnd).toMillis(); - log.trace("run() - duration millis: " + timeSpend); - if(timeSpend < (updateValue * 1000)) { - try { - long sleepTime = (updateValue * 1000) - timeSpend; - log.trace("run() - sleeping millis: " + sleepTime); - if(sleepTime > 0) { - //noinspection BusyWait - sleep(sleepTime); - } - } catch (InterruptedException e) { - log.error("run() - sleep interrupted", e); - } - } else { - log.warn("run() - possible slow response from this HMC"); - } - - } while (keepRunning.get()); - - // Logout of HMC - try { - hmcRestClient.logoff(); - } catch (IOException e) { - log.warn("run() - error logging out of HMC: " + e.getMessage()); - } - - } - - - void discover() { - - log.info("discover() - Querying HMC for Managed Systems and Logical Partitions"); - - Map tmpPartitions = new HashMap<>(); - - try { - hmcRestClient.login(); - hmcRestClient.getManagedSystems().forEach((systemId, system) -> { - - // Add to list of known systems - if(!systems.containsKey(systemId)) { - - // Check excludeSystems and includeSystems - if(!excludeSystems.contains(system.name) && includeSystems.isEmpty()) { - systems.put(systemId, system); - log.info("discover() - ManagedSystem: {}", system); - if (doEnergy) { - hmcRestClient.enableEnergyMonitoring(system); - } - } else if(!includeSystems.isEmpty() && includeSystems.contains(system.name)) { - systems.put(systemId, system); - log.info("discover() - ManagedSystem (include): {}", system); - if (doEnergy) { - hmcRestClient.enableEnergyMonitoring(system); - } - } else { - log.debug("discover() - Skipping ManagedSystem: {}", system); - } - - } - - // Get partitions for this system - try { - tmpPartitions.putAll(hmcRestClient.getLogicalPartitionsForManagedSystem(system)); - - if(!tmpPartitions.isEmpty()) { - partitions.clear(); - //partitions.putAll(tmpPartitions); - tmpPartitions.forEach((lparKey, lpar) -> { - if(!excludePartitions.contains(lpar.name) && includePartitions.isEmpty()) { - partitions.put(lparKey, lpar); - log.info("discover() - LogicalPartition: {}", lpar); - } else if(!includePartitions.isEmpty() && includePartitions.contains(lpar.name)) { - partitions.put(lparKey, lpar); - log.info("discover() - LogicalPartition (include): {}", lpar); - } else { - log.debug("discover() - Skipping LogicalPartition: {}", lpar); - } - }); - } - - } catch (Exception e) { - log.warn("discover() - getLogicalPartitions error: {}", e.getMessage()); - } - - }); - - } catch(Exception e) { - log.warn("discover() - getManagedSystems error: {}", e.getMessage()); - } - - - } - - - void getMetricsForSystems() { - - systems.forEach((systemId, system) -> { - - // Get and process metrics for this system - String tmpJsonString = null; - try { - tmpJsonString = hmcRestClient.getPcmDataForManagedSystem(system); - } catch (Exception e) { - log.warn("getMetricsForSystems() - error: {}", e.getMessage()); - } - - if(tmpJsonString != null && !tmpJsonString.isEmpty()) { - system.processMetrics(tmpJsonString); - if(doTrace) { - writeTraceFile(systemId, tmpJsonString); - } - } - - - }); - - } - - - void getMetricsForPartitions() { - - try { - - // Get partitions for this system - partitions.forEach((partitionId, partition) -> { - - // Get and process metrics for this partition - String tmpJsonString2 = null; - try { - tmpJsonString2 = hmcRestClient.getPcmDataForLogicalPartition(partition); - } catch (Exception e) { - log.warn("getMetricsForPartitions() - getPcmDataForLogicalPartition error: {}", e.getMessage()); - } - if(tmpJsonString2 != null && !tmpJsonString2.isEmpty()) { - partition.processMetrics(tmpJsonString2); - if(doTrace) { - writeTraceFile(partitionId, tmpJsonString2); - } - } - - }); - - } catch(Exception e) { - log.warn("getMetricsForPartitions() - error: {}", e.getMessage()); - } - } - - - void getMetricsForEnergy() { - - systems.forEach((systemId, system) -> { - - // Get and process metrics for this system - String tmpJsonString = null; - try { - tmpJsonString = hmcRestClient.getPcmDataForEnergy(system.energy); - } catch (Exception e) { - log.warn("getMetricsForEnergy() - error: {}", e.getMessage()); - } - - if(tmpJsonString != null && !tmpJsonString.isEmpty()) { - system.energy.processMetrics(tmpJsonString); - } - - }); - - } - - - void writeMetricsForManagedSystems() { - try { - systems.forEach((systemId, system) -> influxClient.writeManagedSystem(system)); - } catch (NullPointerException npe) { - log.warn("writeMetricsForManagedSystems() - NPE: {}", npe.getMessage(), npe); - } - } - - - void writeMetricsForLogicalPartitions() { - try { - partitions.forEach((partitionId, partition) -> influxClient.writeLogicalPartition(partition)); - } catch (NullPointerException npe) { - log.warn("writeMetricsForLogicalPartitions() - NPE: {}", npe.getMessage(), npe); - } - } - - - void writeMetricsForSystemEnergy() { - try { - systems.forEach((systemId, system) -> influxClient.writeSystemEnergy(system.energy)); - } catch (NullPointerException npe) { - log.warn("writeMetricsForSystemEnergy() - NPE: {}", npe.getMessage(), npe); - } - } - - - private void writeTraceFile(String id, String json) { - - String fileName = String.format("%s-%s.json", id, Instant.now().toString()); - try { - log.debug("Writing trace file: " + fileName); - File traceFile = new File(traceDir, fileName); - BufferedWriter writer = new BufferedWriter(new FileWriter(traceFile)); - writer.write(json); - writer.close(); - } catch (IOException e) { - log.warn("writeTraceFile() - " + e.getMessage()); - } - } - -} diff --git a/src/main/java/biz/nellemann/hmci/HmcRestClient.java b/src/main/java/biz/nellemann/hmci/HmcRestClient.java deleted file mode 100644 index 865d75b..0000000 --- a/src/main/java/biz/nellemann/hmci/HmcRestClient.java +++ /dev/null @@ -1,545 +0,0 @@ -/* - * Copyright 2020 Mark Nellemann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package biz.nellemann.hmci; - -import okhttp3.*; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.nodes.Entities; -import org.jsoup.parser.Parser; -import org.jsoup.select.Elements; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.ssl.*; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.cert.X509Certificate; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - - -public class HmcRestClient { - - private final static Logger log = LoggerFactory.getLogger(HmcRestClient.class); - - private final MediaType MEDIA_TYPE_IBM_XML_LOGIN = MediaType.parse("application/vnd.ibm.powervm.web+xml; type=LogonRequest"); - - protected Integer responseErrors = 0; - protected String authToken; - private final OkHttpClient client; - - // OkHttpClient timeouts - private final static int CONNECT_TIMEOUT = 30; - private final static int WRITE_TIMEOUT = 30; - private final static int READ_TIMEOUT = 180; - - private final String baseUrl; - private final String username; - private final String password; - - - HmcRestClient(String url, String username, String password, Boolean unsafe) { - - this.baseUrl = url; - this.username = username; - this.password = password; - - if(unsafe) { - this.client = getUnsafeOkHttpClient(); - } else { - this.client = getSafeOkHttpClient(); - } - - } - - - @Override - public String toString() { - return baseUrl; - } - - - /** - * Logon to the HMC and get an authentication token for further requests. - */ - synchronized void login() throws Exception { - - log.debug("Connecting to HMC - " + baseUrl); - logoff(); - - StringBuilder payload = new StringBuilder(); - payload.append(""); - payload.append(""); - payload.append("").append(username).append(""); - payload.append("").append(password).append(""); - payload.append(""); - - try { - URL url = new URL(String.format("%s/rest/api/web/Logon", baseUrl)); - Request request = new Request.Builder() - .url(url) - .addHeader("Accept", "application/vnd.ibm.powervm.web+xml; type=LogonResponse") - .addHeader("X-Audit-Memento", "hmci") - .put(RequestBody.create(payload.toString(), MEDIA_TYPE_IBM_XML_LOGIN)) - .build(); - - Response response = client.newCall(request).execute(); - String responseBody = Objects.requireNonNull(response.body()).string(); - if (!response.isSuccessful()) { - log.warn("login() - Unexpected response: {}", response.code()); - throw new IOException("Unexpected code: " + response); - } - - Document doc = Jsoup.parse(responseBody); - authToken = doc.select("X-API-Session").text(); - log.debug("login() - Auth Token: " + authToken); - } catch (MalformedURLException e) { - log.error("login() - URL Error: {}", e.getMessage()); - throw e; - } catch (Exception e) { - log.error("login() - Error: {}", e.getMessage()); - throw e; - } - - } - - - - /** - * Logoff from the HMC and remove any session - * - */ - synchronized void logoff() throws IOException { - - if(authToken == null) { - return; - } - - URL absUrl = new URL(String.format("%s/rest/api/web/Logon", baseUrl)); - Request request = new Request.Builder() - .url(absUrl) - .addHeader("Content-Type", "application/vnd.ibm.powervm.web+xml; type=LogonRequest") - .addHeader("X-API-Session", authToken) - .delete() - .build(); - try { - client.newCall(request).execute(); - } catch (IOException e) { - log.warn("logoff() error: {}", e.getMessage()); - } finally { - authToken = null; - } - - } - - - - /** - * Return Map of ManagedSystems seen by this HMC - * - * @return Map of system-id and ManagedSystem - */ - Map getManagedSystems() throws Exception { - - URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem", baseUrl)); - String responseBody = sendGetRequest(url); - Map managedSystemsMap = new HashMap<>(); - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - return managedSystemsMap; - } - - 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( - el.select("Metadata > Atom > AtomID").text(), - el.select("SystemName").text(), - el.select("MachineTypeModelAndSerialNumber > MachineType").text(), - el.select("MachineTypeModelAndSerialNumber > Model").text(), - el.select("MachineTypeModelAndSerialNumber > SerialNumber").text() - ); - managedSystemsMap.put(system.id, system); - log.debug("getManagedSystems() - Found system: {}", system); - } - - } catch(Exception e) { - log.warn("getManagedSystems() - XML parse error", e); - } - - return managedSystemsMap; - } - - - - /** - * Return Map of LogicalPartitions seen by a ManagedSystem on this HMC - * @param system a valid ManagedSystem - * @return Map of partition-id and LogicalPartition - */ - Map getLogicalPartitionsForManagedSystem(ManagedSystem system) throws Exception { - URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id)); - String responseBody = sendGetRequest(url); - Map partitionMap = new HashMap<>(); - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - return partitionMap; - } - - try { - Document doc = Jsoup.parse(responseBody); - Elements logicalPartitions = doc.select("LogicalPartition|LogicalPartition"); - for(Element el : logicalPartitions) { - LogicalPartition logicalPartition = new LogicalPartition( - el.select("PartitionUUID").text(), - el.select("PartitionName").text(), - el.select("PartitionType").text(), - system - ); - partitionMap.put(logicalPartition.id, logicalPartition); - log.debug("getLogicalPartitionsForManagedSystem() - Found partition: {}", logicalPartition); - } - - } catch(Exception e) { - log.warn("getLogicalPartitionsForManagedSystem() - XML parse error: {}", system, e); - } - - return partitionMap; - } - - - /** - * Parse XML feed to get PCM Data in JSON format - * @param system a valid ManagedSystem - * @return JSON string with PCM data for this ManagedSystem - */ - String getPcmDataForManagedSystem(ManagedSystem system) throws Exception { - - log.trace("getPcmDataForManagedSystem() - {}", system.id); - URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=1", baseUrl, system.id)); - String responseBody = sendGetRequest(url); - String jsonBody = null; - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - log.warn("getPcmDataForManagedSystem() - empty response, skipping: {}", system.name); - return null; - } - - try { - Document doc = Jsoup.parse(responseBody); - Element entry = doc.select("feed > entry").first(); - Element link = Objects.requireNonNull(entry).select("link[href]").first(); - - if(Objects.requireNonNull(link).attr("type").equals("application/json")) { - String href = link.attr("href"); - log.trace("getPcmDataForManagedSystem() - URL: {}", href); - jsonBody = sendGetRequest(new URL(href)); - } - - } catch(Exception e) { - log.warn("getPcmDataForManagedSystem() - XML parse error: {}", system, e); - } - - return jsonBody; - } - - - /** - * Parse XML feed to get PCM Data in JSON format - * @param partition a valid LogicalPartition - * @return JSON string with PCM data for this LogicalPartition - */ - String getPcmDataForLogicalPartition(LogicalPartition partition) throws Exception { - - log.trace("getPcmDataForLogicalPartition() - {} @ {}", 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)); - String responseBody = sendGetRequest(url); - String jsonBody = null; - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - log.warn("getPcmDataForLogicalPartition() - empty response, skipping: {}", partition.name); - return null; - } - - try { - Document doc = Jsoup.parse(responseBody); - Element entry = doc.select("feed > entry").first(); - Element link = Objects.requireNonNull(entry).select("link[href]").first(); - - if(Objects.requireNonNull(link).attr("type").equals("application/json")) { - String href = link.attr("href"); - log.trace("getPcmDataForLogicalPartition() - URL: {}", href); - jsonBody = sendGetRequest(new URL(href)); - } - - } catch(Exception e) { - log.warn("getPcmDataForLogicalPartition() - XML parse error: {}", partition.id, e); - } - - return jsonBody; - } - - - /** - * Parse XML feed to get PCM Data in JSON format. - * Does not work for older HMC (pre v9) and older Power server (pre Power 8). - * @param systemEnergy a valid SystemEnergy - * @return JSON string with PCM data for this SystemEnergy - */ - String getPcmDataForEnergy(SystemEnergy systemEnergy) throws Exception { - - log.trace("getPcmDataForEnergy() - " + systemEnergy.system.id); - URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?Type=Energy&NoOfSamples=1", baseUrl, systemEnergy.system.id)); - String responseBody = sendGetRequest(url); - String jsonBody = null; - //log.info(responseBody); - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - log.trace("getPcmDataForEnergy() - empty response, skipping: {}", systemEnergy); - return null; - } - - try { - Document doc = Jsoup.parse(responseBody); - Element entry = doc.select("feed > entry").first(); - Element link = Objects.requireNonNull(entry).select("link[href]").first(); - - if(Objects.requireNonNull(link).attr("type").equals("application/json")) { - String href = link.attr("href"); - log.trace("getPcmDataForEnergy() - URL: {}", href); - jsonBody = sendGetRequest(new URL(href)); - } - - } catch(Exception e) { - log.warn("getPcmDataForEnergy() - XML parse error: {}", systemEnergy, e); - } - - return jsonBody; - } - - - /** - * Set EnergyMonitorEnabled preference to true, if possible. - * @param system - */ - void enableEnergyMonitoring(ManagedSystem system) { - - log.trace("enableEnergyMonitoring() - {}", system); - try { - URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/preferences", baseUrl, system.id)); - String responseBody = sendGetRequest(url); - - // Do not try to parse empty response - if(responseBody == null || responseBody.length() <= 1) { - responseErrors++; - log.warn("enableEnergyMonitoring() - empty response, skipping: {}", system); - return; - } - - Document doc = Jsoup.parse(responseBody, "", Parser.xmlParser()); - doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); - doc.outputSettings().prettyPrint(false); - doc.outputSettings().charset("US-ASCII"); - Element entry = doc.select("feed > entry").first(); - Element link1 = Objects.requireNonNull(entry).select("EnergyMonitoringCapable").first(); - Element link2 = entry.select("EnergyMonitorEnabled").first(); - - if(Objects.requireNonNull(link1).text().equals("true")) { - log.debug("enableEnergyMonitoring() - EnergyMonitoringCapable == true"); - if(Objects.requireNonNull(link2).text().equals("false")) { - //log.warn("enableEnergyMonitoring() - EnergyMonitorEnabled == false"); - link2.text("true"); - - Document content = Jsoup.parse(Objects.requireNonNull(doc.select("Content").first()).html(), "", Parser.xmlParser()); - content.outputSettings().escapeMode(Entities.EscapeMode.xhtml); - content.outputSettings().prettyPrint(false); - content.outputSettings().charset("UTF-8"); - String updateXml = content.outerHtml(); - - sendPostRequest(url, updateXml); - } - } else { - log.warn("enableEnergyMonitoring() - EnergyMonitoringCapable == false"); - } - - } catch (Exception e) { - log.debug("enableEnergyMonitoring() - Error: {}", e.getMessage()); - } - } - - - - /** - * Return a Response from the HMC - * @param url to get Response from - * @return Response body string - */ - private String sendGetRequest(URL url) throws Exception { - - log.trace("getResponse() - URL: {}", url.toString()); - if(authToken == null) { - return null; - } - - Request request = new Request.Builder() - .url(url) - .addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") - .addHeader("X-API-Session", authToken) - .get().build(); - - Response response = client.newCall(request).execute(); - String body = Objects.requireNonNull(response.body()).string(); - - if (!response.isSuccessful()) { - - response.close(); - - if(response.code() == 401) { - log.warn("getResponse() - 401 - login and retry."); - authToken = null; - login(); - return null; - } - - log.error("getResponse() - Unexpected response: {}", response.code()); - throw new IOException("getResponse() - Unexpected response: " + response.code()); - } - - return body; - } - - - /** - * Send a POST request with a payload (can be null) to the HMC - * @param url - * @param payload - * @return - * @throws Exception - */ - public String sendPostRequest(URL url, String payload) throws Exception { - - log.trace("sendPostRequest() - URL: {}", url.toString()); - if(authToken == null) { - return null; - } - - RequestBody requestBody; - if(payload != null) { - //log.debug("sendPostRequest() - payload: " + payload); - requestBody = RequestBody.create(payload, MediaType.get("application/xml")); - } else { - requestBody = RequestBody.create("", null); - } - - - Request request = new Request.Builder() - .url(url) - //.addHeader("Content-Type", "application/xml") - .addHeader("content-type", "application/xml") - .addHeader("X-API-Session", authToken) - .post(requestBody).build(); - - Response response = client.newCall(request).execute(); - String body = Objects.requireNonNull(response.body()).string(); - - if (!response.isSuccessful()) { - response.close(); - log.warn(body); - log.error("sendPostRequest() - Unexpected response: {}", response.code()); - throw new IOException("sendPostRequest() - Unexpected response: " + response.code()); - } - - return body; - } - - - /** - * Provide an unsafe (ignoring SSL problems) OkHttpClient - * - * @return OkHttpClient ignoring SSL/TLS errors - */ - private static OkHttpClient getUnsafeOkHttpClient() { - try { - // Create a trust manager that does not validate certificate chains - final TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) { } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) { - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[]{}; - } - } - }; - - // Install the all-trusting trust manager - final SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(null, trustAllCerts, new SecureRandom()); - - // Create a ssl socket factory with our all-trusting manager - final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); - - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0]); - builder.hostnameVerifier((hostname, session) -> true); - builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS); - builder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS); - builder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); - - return builder.build(); - } catch (KeyManagementException | NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - - /** - * Get OkHttpClient with our preferred timeout values. - * @return OkHttpClient - */ - private static OkHttpClient getSafeOkHttpClient() { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS); - builder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS); - builder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); - return builder.build(); - } - -} diff --git a/src/main/java/biz/nellemann/hmci/InfluxClient.java b/src/main/java/biz/nellemann/hmci/InfluxClient.java index 796ba3b..9df6124 100644 --- a/src/main/java/biz/nellemann/hmci/InfluxClient.java +++ b/src/main/java/biz/nellemann/hmci/InfluxClient.java @@ -15,7 +15,7 @@ */ package biz.nellemann.hmci; -import biz.nellemann.hmci.Configuration.InfluxObject; +import biz.nellemann.hmci.dto.toml.InfluxConfiguration; import org.influxdb.BatchOptions; import org.influxdb.InfluxDB; import org.influxdb.InfluxDBFactory; @@ -26,8 +26,6 @@ import org.slf4j.LoggerFactory; import java.time.Instant; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.TreeMap; import java.util.concurrent.TimeUnit; import static java.lang.Thread.sleep; @@ -43,8 +41,7 @@ public final class InfluxClient { private InfluxDB influxDB; - - InfluxClient(InfluxObject config) { + InfluxClient(InfluxConfiguration config) { this.url = config.url; this.username = config.username; this.password = config.password; @@ -74,8 +71,7 @@ public final class InfluxClient { thread.setDaemon(true); return thread; }) - ); // (4) - + ); Runtime.getRuntime().addShutdownHook(new Thread(influxDB::close)); connected = true; @@ -100,314 +96,27 @@ public final class InfluxClient { influxDB = null; } -/* - synchronized void writeBatchPoints() throws Exception { - log.trace("writeBatchPoints()"); - try { - influxDB.write(batchPoints); - batchPoints = BatchPoints.database(database).precision(TimeUnit.SECONDS).build(); - errorCounter = 0; - } catch (InfluxDBException.DatabaseNotFoundException e) { - log.error("writeBatchPoints() - database \"{}\" not found/created: can't write data", database); - if (++errorCounter > 3) { - throw new RuntimeException(e); - } - } catch (org.influxdb.InfluxDBIOException e) { - log.warn("writeBatchPoints() - io exception: {}", e.getMessage()); - if(++errorCounter < 3) { - log.warn("writeBatchPoints() - reconnecting to InfluxDB due to io exception."); - logoff(); - login(); - writeBatchPoints(); - } else { - throw new RuntimeException(e); - } - } catch(Exception e) { - log.warn("writeBatchPoints() - general exception: {}", e.getMessage()); - if(++errorCounter < 3) { - log.warn("writeBatchPoints() - reconnecting to InfluxDB due to general exception."); - logoff(); - login(); - writeBatchPoints(); - } else { - throw new RuntimeException(e); - } - } - } -*/ - - - /* - Managed System - */ - - - void writeManagedSystem(ManagedSystem system) { - - if(system.metrics == null) { - log.trace("writeManagedSystem() - null metrics, skipping: {}", system.name); - return; - } - - Instant timestamp = system.getTimestamp(); - if(timestamp == null) { - log.warn("writeManagedSystem() - no timestamp, skipping: {}", system.name); - return; - } - - //getSystemDetails(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemDetails(system, timestamp).forEach( it -> influxDB.write(it)); - //getSystemProcessor(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemProcessor(system, timestamp).forEach( it -> influxDB.write(it) ); - //getSystemPhysicalProcessorPool(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemPhysicalProcessorPool(system, timestamp).forEach( it -> influxDB.write(it) ); - //getSystemSharedProcessorPools(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemSharedProcessorPools(system, timestamp).forEach( it -> influxDB.write(it) ); - //getSystemMemory(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemMemory(system, timestamp).forEach( it -> influxDB.write(it) ); - - //getSystemViosDetails(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosDetails(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosProcessor(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemViosProcessor(system, timestamp).forEach( it -> influxDB.write(it) ); - //getSystemViosMemory(system, timestamp).forEach( it -> batchPoints.point(it) ); - getSystemViosMemory(system, timestamp).forEach( it -> influxDB.write(it) ); - - //getSystemViosNetworkLpars(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosNetworkLpars(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosNetworkGenericAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosNetworkGenericAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosNetworkSharedAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosNetworkSharedAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosNetworkVirtualAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosNetworkVirtualAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); - - //getSystemViosStorageLpars(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosStorageLpars(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosFiberChannelAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosFiberChannelAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosStoragePhysicalAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosStoragePhysicalAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemViosStorageVirtualAdapters(system, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemViosStorageVirtualAdapters(system, timestamp).forEach(it -> influxDB.write(it) ); + public void write(List measurements, Instant timestamp, String measurement) { + log.debug("write() - measurement: {} {}", measurement, measurements.size()); + processMeasurementMap(measurements, timestamp, measurement).forEach( (point) -> { influxDB.write(point); }); } - // TODO: server_details - - private static List getSystemDetails(ManagedSystem system, Instant timestamp) { - List metrics = system.getDetails(); - return processMeasurementMap(metrics, timestamp, "server_details"); - } - - private static List getSystemProcessor(ManagedSystem system, Instant timestamp) { - List metrics = system.getProcessorMetrics(); - return processMeasurementMap(metrics, timestamp, "server_processor"); - } - - private static List getSystemPhysicalProcessorPool (ManagedSystem system, Instant timestamp) { - List metrics = system.getPhysicalProcessorPool(); - return processMeasurementMap(metrics, timestamp, "server_physicalProcessorPool"); - } - - private static List getSystemSharedProcessorPools(ManagedSystem system, Instant timestamp) { - List metrics = system.getSharedProcessorPools(); - return processMeasurementMap(metrics, timestamp, "server_sharedProcessorPool"); - } - - private static List getSystemMemory(ManagedSystem system, Instant timestamp) { - List metrics = system.getMemoryMetrics(); - return processMeasurementMap(metrics, timestamp, "server_memory"); - } - - private static List getSystemViosDetails(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosDetails(); - return processMeasurementMap(metrics, timestamp, "vios_details"); - } - - private static List getSystemViosProcessor(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosProcessorMetrics(); - return processMeasurementMap(metrics, timestamp, "vios_processor"); - } - - private static List getSystemViosMemory(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosMemoryMetrics(); - return processMeasurementMap(metrics, timestamp, "vios_memory"); - } - - private static List getSystemViosNetworkLpars(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosNetworkLpars(); - return processMeasurementMap(metrics, timestamp, "vios_network_lpars"); - } - - private static List getSystemViosNetworkVirtualAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosNetworkVirtualAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_network_virtual"); - } - - private static List getSystemViosNetworkSharedAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosNetworkSharedAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_network_shared"); - } - - private static List getSystemViosNetworkGenericAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosNetworkGenericAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_network_generic"); - } - - - private static List getSystemViosStorageLpars(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosStorageLpars(); - return processMeasurementMap(metrics, timestamp, "vios_storage_lpars"); - } - - private static List getSystemViosFiberChannelAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosStorageFiberChannelAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_storage_FC"); - } - - private static List getSystemViosSharedStoragePools(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosStorageSharedStoragePools(); - return processMeasurementMap(metrics, timestamp, "vios_storage_SSP"); - } - - private static List getSystemViosStoragePhysicalAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosStoragePhysicalAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_storage_physical"); - } - - private static List getSystemViosStorageVirtualAdapters(ManagedSystem system, Instant timestamp) { - List metrics = system.getViosStorageVirtualAdapters(); - return processMeasurementMap(metrics, timestamp, "vios_storage_vFC"); - } - - - - - /* - Logical Partitions - */ - - void writeLogicalPartition(LogicalPartition partition) { - - if(partition.metrics == null) { - log.warn("writeLogicalPartition() - null metrics, skipping: {}", partition.name); - return; - } - - Instant timestamp = partition.getTimestamp(); - if(timestamp == null) { - log.warn("writeLogicalPartition() - no timestamp, skipping: {}", partition.name); - return; - } - - //getPartitionDetails(partition, timestamp).forEach( it -> batchPoints.point(it)); - getPartitionDetails(partition, timestamp).forEach( it -> influxDB.write(it)); - //getPartitionMemory(partition, timestamp).forEach( it -> batchPoints.point(it)); - getPartitionMemory(partition, timestamp).forEach( it -> influxDB.write(it)); - //getPartitionProcessor(partition, timestamp).forEach( it -> batchPoints.point(it)); - getPartitionProcessor(partition, timestamp).forEach( it -> influxDB.write(it)); - //getPartitionNetworkVirtual(partition, timestamp).forEach(it -> batchPoints.point(it)); - getPartitionNetworkVirtual(partition, timestamp).forEach(it -> influxDB.write(it)); - getPartitionSriovLogicalPorts(partition, timestamp).forEach(it -> influxDB.write(it)); - //getPartitionStorageVirtualGeneric(partition, timestamp).forEach(it -> batchPoints.point(it)); - getPartitionStorageVirtualGeneric(partition, timestamp).forEach(it -> influxDB.write(it)); - //getPartitionStorageVirtualFibreChannel(partition, timestamp).forEach(it -> batchPoints.point(it)); - getPartitionStorageVirtualFibreChannel(partition, timestamp).forEach(it -> influxDB.write(it)); - - } - - private static List getPartitionDetails(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getDetails(); - return processMeasurementMap(metrics, timestamp, "lpar_details"); - } - - private static List getPartitionProcessor(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getProcessorMetrics(); - return processMeasurementMap(metrics, timestamp, "lpar_processor"); - } - - private static List getPartitionMemory(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getMemoryMetrics(); - return processMeasurementMap(metrics, timestamp, "lpar_memory"); - } - - private static List getPartitionNetworkVirtual(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getVirtualEthernetAdapterMetrics(); - return processMeasurementMap(metrics, timestamp, "lpar_net_virtual"); // Not 'network' - } - - private static List getPartitionSriovLogicalPorts(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getSriovLogicalPorts(); - return processMeasurementMap(metrics, timestamp, "lpar_net_sriov"); // Not 'network' - } - - // TODO: lpar_net_sriov - - private static List getPartitionStorageVirtualGeneric(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getVirtualGenericAdapterMetrics(); - return processMeasurementMap(metrics, timestamp, "lpar_storage_virtual"); - } - - private static List getPartitionStorageVirtualFibreChannel(LogicalPartition partition, Instant timestamp) { - List metrics = partition.getVirtualFibreChannelAdapterMetrics(); - return processMeasurementMap(metrics, timestamp, "lpar_storage_vFC"); - } - - - /* - System Energy - Not supported on older HMC (pre v8) or older Power server (pre Power 8) - */ - - - void writeSystemEnergy(SystemEnergy systemEnergy) { - - if(systemEnergy.metrics == null) { - log.trace("writeSystemEnergy() - null metrics, skipping: {}", systemEnergy.system.name); - return; - } - - Instant timestamp = systemEnergy.getTimestamp(); - if(timestamp == null) { - log.warn("writeSystemEnergy() - no timestamp, skipping: {}", systemEnergy.system.name); - return; - } - - //getSystemEnergyPower(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemEnergyPower(systemEnergy, timestamp).forEach(it -> influxDB.write(it) ); - //getSystemEnergyTemperature(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) ); - getSystemEnergyTemperature(systemEnergy, timestamp).forEach(it -> influxDB.write(it) ); - } - - private static List getSystemEnergyPower(SystemEnergy system, Instant timestamp) { - List metrics = system.getPowerMetrics(); - return processMeasurementMap(metrics, timestamp, "server_energy_power"); - } - - private static List getSystemEnergyTemperature(SystemEnergy system, Instant timestamp) { - List metrics = system.getThermalMetrics(); - return processMeasurementMap(metrics, timestamp, "server_energy_thermal"); - } - - - /* - Shared - */ - - private static List processMeasurementMap(List measurements, Instant timestamp, String measurement) { - + private List processMeasurementMap(List measurements, Instant timestamp, String measurement) { List listOfPoints = new ArrayList<>(); - measurements.forEach( m -> { + measurements.forEach( (m) -> { Point.Builder builder = Point.measurement(measurement) - .time(timestamp.getEpochSecond(), TimeUnit.SECONDS); + .time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS) + .tag(m.tags) + .fields(m.fields); +/* // Iterate fields m.fields.forEach((fieldName, fieldValue) -> { - log.trace("processMeasurementMap() {} - fieldName: {}, fieldValue: {}", measurement, fieldName, fieldValue); + log.info("processMeasurementMap() {} - fieldName: {}, fieldValue: {}", measurement, fieldName, fieldValue); if(fieldValue instanceof Number) { Number num = (Number) fieldValue; builder.addField(fieldName, num); @@ -421,14 +130,18 @@ public final class InfluxClient { }); // Iterate sorted tags - Map sortedTags = new TreeMap(m.tags); + Map sortedTags = new TreeMap<>(m.tags); sortedTags.forEach((tagName, tagValue) -> { - log.trace("processMeasurementMap() {} - tagName: {}, tagValue: {}", measurement, tagName, tagValue); + log.info("processMeasurementMap() {} - tagName: {}, tagValue: {}", measurement, tagName, tagValue); builder.tag(tagName, tagValue); }); +*/ + /* + if(m.fields.size() > 0 && m.tags.size() > 0) { + listOfPoints.add(builderbuilder.build()); + }*/ listOfPoints.add(builder.build()); - }); return listOfPoints; diff --git a/src/main/java/biz/nellemann/hmci/LogicalPartition.java b/src/main/java/biz/nellemann/hmci/LogicalPartition.java index 3177a52..9fa6559 100644 --- a/src/main/java/biz/nellemann/hmci/LogicalPartition.java +++ b/src/main/java/biz/nellemann/hmci/LogicalPartition.java @@ -15,57 +15,151 @@ */ package biz.nellemann.hmci; +import biz.nellemann.hmci.dto.xml.Link; +import biz.nellemann.hmci.dto.xml.LogicalPartitionEntry; +import biz.nellemann.hmci.dto.xml.XmlEntry; +import biz.nellemann.hmci.dto.xml.XmlFeed; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; -class LogicalPartition extends MetaSystem { +class LogicalPartition extends Resource { private final static Logger log = LoggerFactory.getLogger(LogicalPartition.class); - public final String id; - public final String name; - public final String type; - public final ManagedSystem system; + private final RestClient restClient; + private final ManagedSystem managedSystem; + + protected String id; + protected String name; + protected LogicalPartitionEntry entry; + + private String uriPath; - LogicalPartition(String id, String name, String type, ManagedSystem system) { - this.id = id; - this.name = name; - this.type = type; - this.system = system; + public LogicalPartition(RestClient restClient, String href, ManagedSystem managedSystem) throws URISyntaxException { + log.debug("LogicalPartition() - {}", href); + this.restClient = restClient; + this.managedSystem = managedSystem; + try { + URI uri = new URI(href); + uriPath = uri.getPath(); + } catch (URISyntaxException e) { + log.error("LogicalPartition() - {}", e.getMessage()); + } } @Override public String toString() { - return String.format("[%s] %s (%s)", id, name, type); + return entry.getName(); } + public void discover() { + try { + String xml = restClient.getRequest(uriPath); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("discover() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlEntry xmlEntry = xmlMapper.readValue(xml, XmlEntry.class); + + if(xmlEntry.getContent() == null){ + log.warn("discover() - no content."); + return; + } + + this.id = xmlEntry.id; + if(xmlEntry.getContent().isLogicalPartition()) { + entry = xmlEntry.getContent().getLogicalPartitionEntry(); + this.name = entry.getName(); + log.info("discover() - {}", entry.getName()); + } else { + throw new UnsupportedOperationException("Failed to deserialize LogicalPartition"); + } + + } catch (Exception e) { + log.error("discover() - error: {}", e.getMessage()); + } + } + + + public void refresh() { + + log.debug("refresh()"); + try { + String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/LogicalPartition/%s/ProcessedMetrics?NoOfSamples=1", managedSystem.id, id)); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("refresh() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlFeed xmlFeed = xmlMapper.readValue(xml, XmlFeed.class); + + xmlFeed.entries.forEach((entry) -> { + if(entry.category.term.equals("LogicalPartition")) { + Link link = entry.link; + if (link.getType() != null && Objects.equals(link.getType(), "application/json")) { + try { + URI jsonUri = URI.create(link.getHref()); + String json = restClient.getRequest(jsonUri.getPath()); + deserialize(json); + } catch (IOException e) { + log.error("refresh() - error 1: {}", e.getMessage()); + } + } + } + }); + + } catch (IOException e) { + log.error("refresh() - error 2: {}", e.getMessage()); + } + + } + + + // LPAR Details List getDetails() { List list = new ArrayList<>(); - Map tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - log.trace("getDetails() - tags: {}", tagsMap); + try { + Map tagsMap = new HashMap<>(); + TreeMap fieldsMap = new TreeMap<>(); - Map fieldsMap = new HashMap<>(); - fieldsMap.put("id", metrics.systemUtil.sample.lparsUtil.id); - fieldsMap.put("type", metrics.systemUtil.sample.lparsUtil.type); - fieldsMap.put("state", metrics.systemUtil.sample.lparsUtil.state); - fieldsMap.put("osType", metrics.systemUtil.sample.lparsUtil.osType); - fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore); - log.trace("getDetails() - fields: {}", fieldsMap); + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + log.trace("getDetails() - tags: " + tagsMap); + + fieldsMap.put("id", metric.getSample().lparsUtil.id); + fieldsMap.put("type", metric.getSample().lparsUtil.type); + fieldsMap.put("state", metric.getSample().lparsUtil.state); + fieldsMap.put("osType", metric.getSample().lparsUtil.osType); + fieldsMap.put("affinityScore", metric.getSample().lparsUtil.affinityScore); + log.trace("getDetails() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getDetails() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } @@ -75,17 +169,22 @@ class LogicalPartition extends MetaSystem { List list = new ArrayList<>(); - Map tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - log.trace("getMemoryMetrics() - tags: {}", tagsMap); + try { + Map tagsMap = new HashMap<>(); + TreeMap fieldsMap = new TreeMap<>(); - Map fieldsMap = new HashMap<>(); - fieldsMap.put("logicalMem", metrics.systemUtil.sample.lparsUtil.memory.logicalMem); - fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem); - log.trace("getMemoryMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + log.trace("getMemoryMetrics() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); + fieldsMap.put("logicalMem", metric.getSample().lparsUtil.memory.logicalMem); + fieldsMap.put("backedPhysicalMem", metric.getSample().lparsUtil.memory.backedPhysicalMem); + log.trace("getMemoryMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getMemoryMetrics() - error: {}", e.getMessage()); + } return list; } @@ -95,29 +194,35 @@ class LogicalPartition extends MetaSystem { List list = new ArrayList<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - log.trace("getProcessorMetrics() - tags: {}", tagsMap); + try { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits); - fieldsMap.put("entitledProcUnits", metrics.systemUtil.sample.lparsUtil.processor.entitledProcUnits); - fieldsMap.put("donatedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.donatedProcUnits); - fieldsMap.put("idleProcUnits", metrics.systemUtil.sample.lparsUtil.processor.idleProcUnits); - fieldsMap.put("maxProcUnits", metrics.systemUtil.sample.lparsUtil.processor.maxProcUnits); - fieldsMap.put("maxVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.maxVirtualProcessors); - fieldsMap.put("currentVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.currentVirtualProcessors); - fieldsMap.put("utilizedCappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedCappedProcUnits); - fieldsMap.put("utilizedUncappedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedUncappedProcUnits); - fieldsMap.put("timePerInstructionExecution", metrics.systemUtil.sample.lparsUtil.processor.timeSpentWaitingForDispatch); - fieldsMap.put("timeSpentWaitingForDispatch", metrics.systemUtil.sample.lparsUtil.processor.timePerInstructionExecution); - fieldsMap.put("mode", metrics.systemUtil.sample.lparsUtil.processor.mode); - fieldsMap.put("weight", metrics.systemUtil.sample.lparsUtil.processor.weight); - fieldsMap.put("poolId", metrics.systemUtil.sample.lparsUtil.processor.poolId); - log.trace("getProcessorMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + log.trace("getProcessorMetrics() - tags: " + tagsMap); + + fieldsMap.put("utilizedProcUnits", metric.getSample().lparsUtil.processor.utilizedProcUnits); + fieldsMap.put("entitledProcUnits", metric.getSample().lparsUtil.processor.entitledProcUnits); + fieldsMap.put("donatedProcUnits", metric.getSample().lparsUtil.processor.donatedProcUnits); + fieldsMap.put("idleProcUnits", metric.getSample().lparsUtil.processor.idleProcUnits); + fieldsMap.put("maxProcUnits", metric.getSample().lparsUtil.processor.maxProcUnits); + fieldsMap.put("maxVirtualProcessors", metric.getSample().lparsUtil.processor.maxVirtualProcessors); + fieldsMap.put("currentVirtualProcessors", metric.getSample().lparsUtil.processor.currentVirtualProcessors); + fieldsMap.put("utilizedCappedProcUnits", metric.getSample().lparsUtil.processor.utilizedCappedProcUnits); + fieldsMap.put("utilizedUncappedProcUnits", metric.getSample().lparsUtil.processor.utilizedUncappedProcUnits); + fieldsMap.put("timePerInstructionExecution", metric.getSample().lparsUtil.processor.timeSpentWaitingForDispatch); + fieldsMap.put("timeSpentWaitingForDispatch", metric.getSample().lparsUtil.processor.timePerInstructionExecution); + fieldsMap.put("mode", metric.getSample().lparsUtil.processor.mode); + fieldsMap.put("weight", metric.getSample().lparsUtil.processor.weight); + fieldsMap.put("poolId", metric.getSample().lparsUtil.processor.poolId); + log.trace("getProcessorMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getProcessorMetrics() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } @@ -127,72 +232,41 @@ class LogicalPartition extends MetaSystem { List list = new ArrayList<>(); - metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.forEach( adapter -> { + try { + metric.getSample().lparsUtil.network.virtualEthernetAdapters.forEach(adapter -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - tagsMap.put("location", adapter.physicalLocation); - tagsMap.put("viosId", adapter.viosId.toString()); - tagsMap.put("vlanId", adapter.vlanId.toString()); - tagsMap.put("vswitchId", adapter.vswitchId.toString()); - log.trace("getVirtualEthernetAdapterMetrics() - tags: {}", tagsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("droppedPackets", adapter.droppedPackets); - fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets); - fieldsMap.put("isPortVlanId", adapter.isPortVlanId); - fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes); - fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets); - fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes); - fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets); - fieldsMap.put("receivedBytes", adapter.receivedBytes); - fieldsMap.put("receivedPackets", adapter.receivedPackets); - fieldsMap.put("sentBytes", adapter.sentBytes); - fieldsMap.put("sentPackets", adapter.sentPackets); - fieldsMap.put("transferredBytes", adapter.transferredBytes); - fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes); - fieldsMap.put("sharedEthernetAdapterId", adapter.sharedEthernetAdapterId); - log.trace("getVirtualEthernetAdapterMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + tagsMap.put("location", adapter.physicalLocation); + tagsMap.put("viosId", adapter.viosId.toString()); + tagsMap.put("vlanId", adapter.vlanId.toString()); + tagsMap.put("vswitchId", adapter.vswitchId.toString()); + log.trace("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + fieldsMap.put("droppedPackets", adapter.droppedPackets); + fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets); + fieldsMap.put("isPortVlanId", adapter.isPortVlanId); + fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes); + fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets); + fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes); + fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets); + fieldsMap.put("receivedBytes", adapter.receivedBytes); + fieldsMap.put("receivedPackets", adapter.receivedPackets); + fieldsMap.put("sentBytes", adapter.sentBytes); + fieldsMap.put("sentPackets", adapter.sentPackets); + fieldsMap.put("transferredBytes", adapter.transferredBytes); + fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes); + fieldsMap.put("sharedEthernetAdapterId", adapter.sharedEthernetAdapterId); + log.trace("getVirtualEthernetAdapterMetrics() - fields: " + fieldsMap); - return list; - } - - - // LPAR Network - SR-IOV - List getSriovLogicalPorts() { - - List list = new ArrayList<>(); - - metrics.systemUtil.sample.lparsUtil.network.sriovLogicalPorts.forEach( port -> { - - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - tagsMap.put("location", port.physicalLocation); - tagsMap.put("vnicDeviceMode", port.vnicDeviceMode); - tagsMap.put("configurationType", port.configurationType); - log.trace("getSriovLogicalPorts() - tags: {}", tagsMap); - - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("drcIndex", port.drcIndex); - fieldsMap.put("physicalPortId", port.physicalPortId); - fieldsMap.put("physicalDrcIndex", port.physicalDrcIndex); - fieldsMap.put("droppedPackets", port.droppedPackets); - fieldsMap.put("receivedBytes", port.receivedBytes); - fieldsMap.put("receivedPackets", port.receivedPackets); - fieldsMap.put("sentBytes", port.sentBytes); - fieldsMap.put("sentPackets", port.sentPackets); - fieldsMap.put("errorIn", port.errorIn); - fieldsMap.put("errorOut", port.errorOut); - fieldsMap.put("transferredBytes", port.transferredBytes); - log.trace("getSriovLogicalPorts() - fields: {}", fieldsMap); - - list.add(new Measurement(tagsMap, fieldsMap)); - }); + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVirtualEthernetAdapterMetrics() - error: {}", e.getMessage()); + } return list; } @@ -202,26 +276,33 @@ class LogicalPartition extends MetaSystem { List getVirtualGenericAdapterMetrics() { List list = new ArrayList<>(); - metrics.systemUtil.sample.lparsUtil.storage.genericVirtualAdapters.forEach( adapter -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - tagsMap.put("viosId", adapter.viosId.toString()); - tagsMap.put("location", adapter.physicalLocation); - tagsMap.put("id", adapter.id); - log.trace("getVirtualGenericAdapterMetrics() - tags: {}", tagsMap); + try { + metric.getSample().lparsUtil.storage.genericVirtualAdapters.forEach(adapter -> { - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("numOfReads", adapter.numOfReads); - fieldsMap.put("numOfWrites", adapter.numOfWrites); - fieldsMap.put("writeBytes", adapter.writeBytes); - fieldsMap.put("readBytes", adapter.readBytes); - fieldsMap.put("type", adapter.type); - log.trace("getVirtualGenericAdapterMetrics() - fields: {}", fieldsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); + + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + tagsMap.put("viosId", adapter.viosId.toString()); + tagsMap.put("location", adapter.physicalLocation); + tagsMap.put("id", adapter.id); + log.trace("getVirtualGenericAdapterMetrics() - tags: " + tagsMap); + + fieldsMap.put("numOfReads", adapter.numOfReads); + fieldsMap.put("numOfWrites", adapter.numOfWrites); + fieldsMap.put("writeBytes", adapter.writeBytes); + fieldsMap.put("readBytes", adapter.readBytes); + fieldsMap.put("type", adapter.type); + log.trace("getVirtualGenericAdapterMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVirtualGenericAdapterMetrics() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); - }); return list; } @@ -230,32 +311,71 @@ class LogicalPartition extends MetaSystem { List getVirtualFibreChannelAdapterMetrics() { List list = new ArrayList<>(); - metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - tagsMap.put("lparname", name); - tagsMap.put("viosId", adapter.viosId.toString()); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getVirtualFibreChannelAdapterMetrics() - tags: {}", tagsMap); + try { + metric.getSample().lparsUtil.storage.virtualFiberChannelAdapters.forEach(adapter -> { - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("numOfReads", adapter.numOfReads); - fieldsMap.put("numOfWrites", adapter.numOfWrites); - fieldsMap.put("writeBytes", adapter.writeBytes); - fieldsMap.put("readBytes", adapter.readBytes); - fieldsMap.put("runningSpeed", adapter.runningSpeed); - fieldsMap.put("transmittedBytes", adapter.transmittedBytes); - fieldsMap.put("transferredByte", adapter.transmittedBytes); // TODO: Must be error in dashboard, remove when checked. - //fieldsMap.put("wwpn", adapter.wwpn); - //fieldsMap.put("wwpn2", adapter.wwpn2); - log.trace("getVirtualFibreChannelAdapterMetrics() - fields: {}", fieldsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + tagsMap.put("viosId", adapter.viosId.toString()); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVirtualFibreChannelAdapterMetrics() - tags: " + tagsMap); + + fieldsMap.put("numOfReads", adapter.numOfReads); + fieldsMap.put("numOfWrites", adapter.numOfWrites); + fieldsMap.put("writeBytes", adapter.writeBytes); + fieldsMap.put("readBytes", adapter.readBytes); + fieldsMap.put("runningSpeed", adapter.runningSpeed); + fieldsMap.put("transmittedBytes", adapter.transmittedBytes); + fieldsMap.put("transferredByte", adapter.transmittedBytes); // TODO: Must be error in dashboard, remove when checked. + log.trace("getVirtualFibreChannelAdapterMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVirtualFibreChannelAdapterMetrics() - error: {}", e.getMessage()); + } return list; } + // LPAR Network - SR-IOV Logical Ports + List getSriovLogicalPorts() { + + List list = new ArrayList<>(); + + try { + metric.getSample().lparsUtil.network.sriovLogicalPorts.forEach(port -> { + + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); + + tagsMap.put("servername", managedSystem.entry.getName()); + tagsMap.put("lparname", entry.getName()); + tagsMap.put("location", port.physicalLocation); + tagsMap.put("type", port.configurationType); + log.trace("getSriovLogicalPorts() - tags: " + tagsMap); + + fieldsMap.put("sentBytes", port.sentBytes); + fieldsMap.put("receivedBytes", port.receivedBytes); + fieldsMap.put("transferredBytes", port.transferredBytes); + fieldsMap.put("sentPackets", port.sentPackets); + fieldsMap.put("receivedPackets", port.receivedPackets); + fieldsMap.put("droppedPackets", port.droppedPackets); + fieldsMap.put("errorIn", port.errorIn); + fieldsMap.put("errorOut", port.errorOut); + log.trace("getSriovLogicalPorts() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getSriovLogicalPorts() - error: {}", e.getMessage()); + } + + return list; + } } diff --git a/src/main/java/biz/nellemann/hmci/ManagedSystem.java b/src/main/java/biz/nellemann/hmci/ManagedSystem.java index 422c198..34dfae4 100644 --- a/src/main/java/biz/nellemann/hmci/ManagedSystem.java +++ b/src/main/java/biz/nellemann/hmci/ManagedSystem.java @@ -15,440 +15,768 @@ */ package biz.nellemann.hmci; +import biz.nellemann.hmci.dto.json.SystemUtil; +import biz.nellemann.hmci.dto.json.Temperature; +import biz.nellemann.hmci.dto.xml.*; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; -class ManagedSystem extends MetaSystem { +class ManagedSystem extends Resource { private final static Logger log = LoggerFactory.getLogger(ManagedSystem.class); - //public final String hmcId; - public final String id; - public final String name; - public final String type; - public final String model; - public final String serialNumber; + protected final List logicalPartitions = new ArrayList<>(); + protected final List virtualIOServers = new ArrayList<>(); - public final SystemEnergy energy; + private List excludePartitions = new ArrayList<>(); + private List includePartitions = new ArrayList<>(); + + private Boolean doEnergy = true; + + private final RestClient restClient; + + protected ManagedSystemEntry entry; + + protected SystemEnergy systemEnergy; + + private String uriPath; + public String name; + public String id; - ManagedSystem(String id, String name, String type, String model, String serialNumber) { - this.id = id; - this.name = name; - this.type = type; - this.model = model; - this.serialNumber = serialNumber; - this.energy = new SystemEnergy(this); + public ManagedSystem(RestClient restClient, String href) { + log.debug("ManagedSystem() - {}", href); + this.restClient = restClient; + try { + URI uri = new URI(href); + uriPath = uri.getPath(); + } catch (URISyntaxException e) { + log.error("ManagedSystem() - {}", e.getMessage()); + } } + @Override public String toString() { - return String.format("[%s] %s (%s-%s %s)", id, name, type, model, serialNumber); + //return String.format("[%s] %s (%s-%s %s)", id, name, type, model, serialNumber); + return "TODO"; } + public void setExcludePartitions(List excludePartitions) { + this.excludePartitions = excludePartitions; + } + + public void setIncludePartitions(List includePartitions) { + this.includePartitions = includePartitions; + } + + public void setDoEnergy(Boolean doEnergy) { + this.doEnergy = doEnergy; + // TODO: Enable energy command. + systemEnergy = new SystemEnergy(restClient, this); + } + + public void discover() { + + try { + String xml = restClient.getRequest(uriPath); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("discover() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlEntry xmlEntry = xmlMapper.readValue(xml, XmlEntry.class); + + if(xmlEntry.getContent() == null){ + log.warn("discover() - no content."); + return; + } + + this.id = xmlEntry.id; + if(xmlEntry.getContent().isManagedSystem()) { + entry = xmlEntry.getContent().getManagedSystemEntry(); + this.name = entry.getName(); + } else { + throw new UnsupportedOperationException("Failed to deserialize ManagedSystem"); + } + + logicalPartitions.clear(); + for (Link link : this.entry.getAssociatedLogicalPartitions()) { + LogicalPartition logicalPartition = new LogicalPartition(restClient, link.getHref(), this); + logicalPartition.discover(); + + // Check exclude / include + if(!excludePartitions.contains(logicalPartition.name) && includePartitions.isEmpty()) { + logicalPartitions.add(logicalPartition); + //log.info("discover() - adding !excluded partition: {}", logicalPartition.name); + } else if(!includePartitions.isEmpty() && includePartitions.contains(logicalPartition.name)) { + logicalPartitions.add(logicalPartition); + //log.info("discover() - adding included partition: {}", logicalPartition.name); + } + } + + virtualIOServers.clear(); + for (Link link : this.entry.getAssociatedVirtualIOServers()) { + VirtualIOServer virtualIOServer = new VirtualIOServer(restClient, link.getHref(), this); + virtualIOServer.discover(); + virtualIOServers.add(virtualIOServer); + } + + } catch (Exception e) { + log.warn("discover() - error: {}", e.getMessage()); + } + + } + + + public void refresh() { + + log.debug("refresh()"); + try { + String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=1", id)); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("refresh() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlFeed xmlFeed = xmlMapper.readValue(xml, XmlFeed.class); + + xmlFeed.entries.forEach((entry) -> { + if (entry.category.term.equals("ManagedSystem")) { + Link link = entry.link; + if (link.getType() != null && Objects.equals(link.getType(), "application/json")) { + try { + URI jsonUri = URI.create(link.getHref()); + String json = restClient.getRequest(jsonUri.getPath()); + deserialize(json); + } catch (IOException e) { + log.error("refresh() - error 1: {}", e.getMessage()); + } + } + } + }); + + } catch (JsonParseException e) { + log.warn("refresh() - parse error for: {}", name); + metric = null; + } catch (IOException e) { + log.error("refresh() - error 2: {} {}", e.getClass(), e.getMessage()); + metric = null; + } + + } + + + + + /* + void enableEnergyMonitoring() { + + log.trace("enableEnergyMonitoring() - {}", system); + try { + URL url = new URL(String.format("%s/rest/api/pcm/ManagedSystem/%s/preferences", baseUrl, system.id)); + String responseBody = sendGetRequest(url); + + // Do not try to parse empty response + if(responseBody == null || responseBody.length() <= 1) { + responseErrors++; + log.warn("enableEnergyMonitoring() - empty response, skipping: {}", system); + return; + } + + Document doc = Jsoup.parse(responseBody, "", Parser.xmlParser()); + doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml); + doc.outputSettings().prettyPrint(false); + doc.outputSettings().charset("US-ASCII"); + Element entry = doc.select("feed > entry").first(); + Element link1 = Objects.requireNonNull(entry).select("EnergyMonitoringCapable").first(); + Element link2 = entry.select("EnergyMonitorEnabled").first(); + + if(Objects.requireNonNull(link1).text().equals("true")) { + log.debug("enableEnergyMonitoring() - EnergyMonitoringCapable == true"); + if(Objects.requireNonNull(link2).text().equals("false")) { + //log.warn("enableEnergyMonitoring() - EnergyMonitorEnabled == false"); + link2.text("true"); + + Document content = Jsoup.parse(Objects.requireNonNull(doc.select("Content").first()).html(), "", Parser.xmlParser()); + content.outputSettings().escapeMode(Entities.EscapeMode.xhtml); + content.outputSettings().prettyPrint(false); + content.outputSettings().charset("UTF-8"); + String updateXml = content.outerHtml(); + + sendPostRequest(url, updateXml); + } + } else { + log.warn("enableEnergyMonitoring() - EnergyMonitoringCapable == false"); + } + + } catch (Exception e) { + log.debug("enableEnergyMonitoring() - Error: {}", e.getMessage()); + } + } + */ + + + // System details List getDetails() { List list = new ArrayList<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - log.trace("getDetails() - tags: {}", tagsMap); + try { + Map tagsMap = new TreeMap<>(); + Map fieldsMap = new TreeMap<>(); - Map fieldsMap = new HashMap<>(); - fieldsMap.put("mtm", String.format("%s-%s %s", type, model, serialNumber)); - fieldsMap.put("APIversion", metrics.systemUtil.utilInfo.version); - fieldsMap.put("metric", metrics.systemUtil.utilInfo.metricType); - fieldsMap.put("frequency", metrics.systemUtil.utilInfo.frequency); - fieldsMap.put("nextract", "HMCi"); - fieldsMap.put("name", name); - fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.systemFirmwareUtil.utilizedProcUnits); - fieldsMap.put("assignedMem", metrics.systemUtil.sample.systemFirmwareUtil.assignedMem); - log.trace("getDetails() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + log.trace("getDetails() - tags: " + tagsMap); + + fieldsMap.put("mtm", String.format("%s-%s %s", + entry.getMachineTypeModelAndSerialNumber().getMachineType(), + entry.getMachineTypeModelAndSerialNumber().getModel(), + entry.getMachineTypeModelAndSerialNumber().getSerialNumber()) + ); + fieldsMap.put("APIversion", metric.getUtilInfo().version); + fieldsMap.put("metric", metric.utilInfo.metricType); + fieldsMap.put("frequency", metric.getUtilInfo().frequency); + fieldsMap.put("nextract", "HMCi"); + fieldsMap.put("name", entry.getName()); + fieldsMap.put("utilizedProcUnits", metric.getSample().systemFirmwareUtil.utilizedProcUnits); + fieldsMap.put("assignedMem", metric.getSample().systemFirmwareUtil.assignedMem); + log.trace("getDetails() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getDetails() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } - // Memory + // System Memory List getMemoryMetrics() { List list = new ArrayList<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - log.trace("getMemoryMetrics() - tags: {}", tagsMap); + try { + HashMap tagsMap = new HashMap<>(); + Map fieldsMap = new HashMap<>(); - Map fieldsMap = new HashMap<>(); - fieldsMap.put("totalMem", metrics.systemUtil.sample.serverUtil.memory.totalMem); - fieldsMap.put("availableMem", metrics.systemUtil.sample.serverUtil.memory.availableMem); - fieldsMap.put("configurableMem", metrics.systemUtil.sample.serverUtil.memory.configurableMem); - fieldsMap.put("assignedMemToLpars", metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars); - fieldsMap.put("virtualPersistentMem", metrics.systemUtil.sample.serverUtil.memory.virtualPersistentMem); - log.trace("getMemoryMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + log.trace("getMemoryMetrics() - tags: " + tagsMap); + + fieldsMap.put("totalMem", metric.getSample().serverUtil.memory.totalMem); + fieldsMap.put("availableMem", metric.getSample().serverUtil.memory.availableMem); + fieldsMap.put("configurableMem", metric.getSample().serverUtil.memory.configurableMem); + fieldsMap.put("assignedMemToLpars", metric.getSample().serverUtil.memory.assignedMemToLpars); + fieldsMap.put("virtualPersistentMem", metric.getSample().serverUtil.memory.virtualPersistentMem); + log.trace("getMemoryMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getMemoryMetrics() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } - // Processor + // System Processor List getProcessorMetrics() { List list = new ArrayList<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - log.trace("getProcessorMetrics() - tags: {}", tagsMap); + try { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("totalProcUnits", metrics.systemUtil.sample.serverUtil.processor.totalProcUnits); - fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.processor.utilizedProcUnits); - fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.processor.availableProcUnits); - fieldsMap.put("configurableProcUnits", metrics.systemUtil.sample.serverUtil.processor.configurableProcUnits); - log.trace("getProcessorMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + log.trace("getProcessorMetrics() - tags: " + tagsMap); + + fieldsMap.put("totalProcUnits", metric.getSample().serverUtil.processor.totalProcUnits); + fieldsMap.put("utilizedProcUnits", metric.getSample().serverUtil.processor.utilizedProcUnits); + fieldsMap.put("availableProcUnits", metric.getSample().serverUtil.processor.availableProcUnits); + fieldsMap.put("configurableProcUnits", metric.getSample().serverUtil.processor.configurableProcUnits); + log.trace("getProcessorMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getProcessorMetrics() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } - // Shared ProcessorPools + // Sytem Shared ProcessorPools List getSharedProcessorPools() { List list = new ArrayList<>(); - metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> { + try { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("pool", sharedProcessorPool.id); - tagsMap.put("poolname", sharedProcessorPool.name); - log.trace("getSharedProcessorPools() - tags: {}", tagsMap); + metric.getSample().serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("assignedProcUnits", sharedProcessorPool.assignedProcUnits); - fieldsMap.put("availableProcUnits", sharedProcessorPool.availableProcUnits); - fieldsMap.put("utilizedProcUnits", sharedProcessorPool.utilizedProcUnits); - fieldsMap.put("borrowedProcUnits", sharedProcessorPool.borrowedProcUnits); - fieldsMap.put("configuredProcUnits", sharedProcessorPool.configuredProcUnits); - log.trace("getSharedProcessorPools() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + tagsMap.put("pool", String.valueOf(sharedProcessorPool.id)); + tagsMap.put("poolname", sharedProcessorPool.name); + log.trace("getSharedProcessorPools() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + fieldsMap.put("assignedProcUnits", sharedProcessorPool.assignedProcUnits); + fieldsMap.put("availableProcUnits", sharedProcessorPool.availableProcUnits); + fieldsMap.put("utilizedProcUnits", sharedProcessorPool.utilizedProcUnits); + fieldsMap.put("borrowedProcUnits", sharedProcessorPool.borrowedProcUnits); + fieldsMap.put("configuredProcUnits", sharedProcessorPool.configuredProcUnits); + log.trace("getSharedProcessorPools() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getSharedProcessorPools() - error: {}", e.getMessage()); + + } return list; } - - // Physical ProcessorPool + // System Physical ProcessorPool List getPhysicalProcessorPool() { List list = new ArrayList<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - log.trace("getPhysicalProcessorPool() - tags: {}", tagsMap); + try { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("assignedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.assignedProcUnits); - fieldsMap.put("availableProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.availableProcUnits); - fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.utilizedProcUnits); - fieldsMap.put("configuredProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.configuredProcUnits); - fieldsMap.put("borrowedProcUnits", metrics.systemUtil.sample.serverUtil.physicalProcessorPool.borrowedProcUnits); - log.trace("getPhysicalProcessorPool() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + log.trace("getPhysicalProcessorPool() - tags: " + tagsMap); + + fieldsMap.put("assignedProcUnits", metric.getSample().serverUtil.physicalProcessorPool.assignedProcUnits); + fieldsMap.put("availableProcUnits", metric.getSample().serverUtil.physicalProcessorPool.availableProcUnits); + fieldsMap.put("utilizedProcUnits", metric.getSample().serverUtil.physicalProcessorPool.utilizedProcUnits); + fieldsMap.put("configuredProcUnits", metric.getSample().serverUtil.physicalProcessorPool.configuredProcUnits); + fieldsMap.put("borrowedProcUnits", metric.getSample().serverUtil.physicalProcessorPool.borrowedProcUnits); + log.trace("getPhysicalProcessorPool() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getPhysicalProcessorPool() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } + /** + * VIO Aggregated Metrics are stored under the Managed System + */ + + // VIO Details - List getViosDetails() { + List getVioDetails() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - log.trace("getViosDetails() - tags: {}", tagsMap); + try { + metric.getSample().viosUtil.forEach(vio -> { - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("viosid", vios.id); - fieldsMap.put("viosstate", vios.state); - fieldsMap.put("viosname", vios.name); - fieldsMap.put("affinityScore", vios.affinityScore); - log.trace("getViosDetails() - fields: {}", fieldsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + log.trace("getVioDetails() - tags: " + tagsMap); + + fieldsMap.put("viosid", vio.id); + fieldsMap.put("viosstate", vio.state); + fieldsMap.put("viosname", vio.name); + fieldsMap.put("affinityScore", vio.affinityScore); + log.trace("getVioDetails() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVioDetails() - error: {}", e.getMessage()); + } return list; } // VIO Memory - List getViosMemoryMetrics() { + List getVioMemoryMetrics() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { + try { + metric.getSample().viosUtil.forEach(vio -> { HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - log.trace("getViosMemoryMetrics() - tags: {}", tagsMap); - HashMap fieldsMap = new HashMap<>(); - Number assignedMem = getNumberMetricObject(vios.memory.assignedMem); - Number utilizedMem = getNumberMetricObject(vios.memory.utilizedMem); - if(assignedMem != null) { - fieldsMap.put("assignedMem", vios.memory.assignedMem); - } - if(utilizedMem != null) { - fieldsMap.put("utilizedMem", vios.memory.utilizedMem); - } - if(assignedMem != null && utilizedMem != null) { - Number usedMemPct = (utilizedMem.intValue() * 100 ) / assignedMem.intValue(); - fieldsMap.put("utilizedPct", usedMemPct.floatValue()); - } - log.trace("getViosMemoryMetrics() - fields: {}", fieldsMap); + + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + log.trace("getVioMemoryMetrics() - tags: " + tagsMap); + + Number assignedMem = vio.memory.assignedMem; + Number utilizedMem = vio.memory.utilizedMem; + Number usedMemPct = (utilizedMem.intValue() * 100 ) / assignedMem.intValue(); + fieldsMap.put("assignedMem", vio.memory.assignedMem); + fieldsMap.put("utilizedMem", vio.memory.utilizedMem); + fieldsMap.put("utilizedPct", usedMemPct.floatValue()); + log.trace("getVioMemoryMetrics() - fields: " + fieldsMap); list.add(new Measurement(tagsMap, fieldsMap)); }); + } catch (Exception e) { + log.warn("getVioMemoryMetrics() - error: {}", e.getMessage()); + } return list; } // VIO Processor - List getViosProcessorMetrics() { + List getVioProcessorMetrics() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { + try { + metric.getSample().viosUtil.forEach(vio -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - log.trace("getViosProcessorMetrics() - tags: {}", tagsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("utilizedProcUnits", vios.processor.utilizedProcUnits); - fieldsMap.put("utilizedCappedProcUnits", vios.processor.utilizedCappedProcUnits); - fieldsMap.put("utilizedUncappedProcUnits", vios.processor.utilizedUncappedProcUnits); - fieldsMap.put("currentVirtualProcessors", vios.processor.currentVirtualProcessors); - fieldsMap.put("maxVirtualProcessors", vios.processor.maxVirtualProcessors); - fieldsMap.put("maxProcUnits", vios.processor.maxProcUnits); - fieldsMap.put("entitledProcUnits", vios.processor.entitledProcUnits); - fieldsMap.put("donatedProcUnits", vios.processor.donatedProcUnits); - fieldsMap.put("idleProcUnits", vios.processor.idleProcUnits); - fieldsMap.put("timeSpentWaitingForDispatch", vios.processor.timePerInstructionExecution); - fieldsMap.put("timePerInstructionExecution", vios.processor.timeSpentWaitingForDispatch); - fieldsMap.put("weight", vios.processor.weight); - fieldsMap.put("mode", vios.processor.mode); - log.trace("getViosProcessorMetrics() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + log.trace("getVioProcessorMetrics() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + fieldsMap.put("utilizedProcUnits", vio.processor.utilizedProcUnits); + fieldsMap.put("utilizedCappedProcUnits", vio.processor.utilizedCappedProcUnits); + fieldsMap.put("utilizedUncappedProcUnits", vio.processor.utilizedUncappedProcUnits); + fieldsMap.put("currentVirtualProcessors", vio.processor.currentVirtualProcessors); + fieldsMap.put("maxVirtualProcessors", vio.processor.maxVirtualProcessors); + fieldsMap.put("maxProcUnits", vio.processor.maxProcUnits); + fieldsMap.put("entitledProcUnits", vio.processor.entitledProcUnits); + fieldsMap.put("donatedProcUnits", vio.processor.donatedProcUnits); + fieldsMap.put("idleProcUnits", vio.processor.idleProcUnits); + fieldsMap.put("timeSpentWaitingForDispatch", vio.processor.timePerInstructionExecution); + fieldsMap.put("timePerInstructionExecution", vio.processor.timeSpentWaitingForDispatch); + fieldsMap.put("weight", vio.processor.weight); + fieldsMap.put("mode", vio.processor.mode); + log.trace("getVioProcessorMetrics() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVioProcessorMetrics() - error: {}", e.getMessage()); + } return list; } // VIOs - Network - List getViosNetworkLpars() { + List getVioNetworkLpars() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { + try { + metric.getSample().viosUtil.forEach(vio -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - log.trace("getViosNetworkLpars() - tags: {}", tagsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("clientlpars", vios.network.clientLpars.size()); - log.trace("getViosNetworkLpars() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + log.trace("getVioNetworkLpars() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + fieldsMap.put("clientlpars", vio.network.clientLpars.size()); + log.trace("getVioNetworkLpars() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + + } catch (Exception e) { + log.warn("getVioNetworkLpars() - error: {}", e.getMessage()); + } return list; } // VIO Network - Shared - List getViosNetworkSharedAdapters() { + List getVioNetworkSharedAdapters() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { + try { + metric.getSample().viosUtil.forEach(vio -> { + vio.network.sharedAdapters.forEach(adapter -> { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - vios.network.sharedAdapters.forEach(adapter -> { + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + //tagsMap.put("id", adapter.id); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVioNetworkSharedAdapters() - tags: " + tagsMap); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - //tagsMap.put("id", adapter.id); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getViosNetworkSharedAdapters() - tags: {}", tagsMap); + fieldsMap.put("id", adapter.id); + fieldsMap.put("type", adapter.type); + fieldsMap.put("sentBytes", adapter.sentBytes); + fieldsMap.put("sentPackets", adapter.sentPackets); + fieldsMap.put("receivedBytes", adapter.receivedBytes); + fieldsMap.put("receivedPackets", adapter.receivedPackets); + fieldsMap.put("droppedPackets", adapter.droppedPackets); + fieldsMap.put("transferredBytes", adapter.transferredBytes); + log.trace("getVioNetworkSharedAdapters() - fields: " + fieldsMap); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("id", adapter.id); - fieldsMap.put("type", adapter.type); - fieldsMap.put("sentBytes", adapter.sentBytes); - fieldsMap.put("sentPackets", adapter.sentPackets); - fieldsMap.put("receivedBytes", adapter.receivedBytes); - fieldsMap.put("receivedPackets", adapter.receivedPackets); - fieldsMap.put("droppedPackets", adapter.droppedPackets); - fieldsMap.put("transferredBytes", adapter.transferredBytes); - log.trace("getViosNetworkSharedAdapters() - fields: {}", fieldsMap); - - list.add(new Measurement(tagsMap, fieldsMap)); + list.add(new Measurement(tagsMap, fieldsMap)); + }); }); - - }); + } catch (Exception e) { + log.warn("getVioNetworkSharedAdapters() - error: {}", e.getMessage()); + } return list; } // VIO Network - Virtual - List getViosNetworkVirtualAdapters() { + List getVioNetworkVirtualAdapters() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach( vios -> { + try { + metric.getSample().viosUtil.forEach( vio -> { + vio.network.virtualEthernetAdapters.forEach( adapter -> { - vios.network.virtualEthernetAdapters.forEach( adapter -> { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("vlanid", String.valueOf(adapter.vlanId)); - tagsMap.put("vswitchid", String.valueOf(adapter.vswitchId)); - tagsMap.put("systemname", name); - tagsMap.put("viosname", vios.name); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getViosNetworkVirtualAdapters() - tags: {}", tagsMap); + tagsMap.put("vlanid", String.valueOf(adapter.vlanId)); + tagsMap.put("vswitchid", String.valueOf(adapter.vswitchId)); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVioNetworkVirtualAdapters() - tags: " + tagsMap); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("droppedPackets", adapter.droppedPackets); - fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets); - fieldsMap.put("isPortVlanId", adapter.isPortVlanId); - fieldsMap.put("receivedBytes", adapter.receivedBytes); - fieldsMap.put("receivedPackets", adapter.receivedPackets); - fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes); - fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets); - fieldsMap.put("sentBytes", adapter.sentBytes); - fieldsMap.put("sentPackets", adapter.sentPackets); - fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes); - fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets); - fieldsMap.put("transferredBytes", adapter.transferredBytes); - fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes); - log.trace("getViosNetworkVirtualAdapters() - fields: {}", fieldsMap); + fieldsMap.put("droppedPackets", adapter.droppedPackets); + fieldsMap.put("droppedPhysicalPackets", adapter.droppedPhysicalPackets); + fieldsMap.put("isPortVlanId", adapter.isPortVlanId); + fieldsMap.put("receivedBytes", adapter.receivedBytes); + fieldsMap.put("receivedPackets", adapter.receivedPackets); + fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes); + fieldsMap.put("receivedPhysicalPackets", adapter.receivedPhysicalPackets); + fieldsMap.put("sentBytes", adapter.sentBytes); + fieldsMap.put("sentPackets", adapter.sentPackets); + fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes); + fieldsMap.put("sentPhysicalPackets", adapter.sentPhysicalPackets); + fieldsMap.put("transferredBytes", adapter.transferredBytes); + fieldsMap.put("transferredPhysicalBytes", adapter.transferredPhysicalBytes); + log.trace("getVioNetworkVirtualAdapters() - fields: " + fieldsMap); - list.add(new Measurement(tagsMap, fieldsMap)); + list.add(new Measurement(tagsMap, fieldsMap)); + }); }); - - }); + } catch (Exception e) { + log.warn("getVioNetworkVirtualAdapters() - error: {}", e.getMessage()); + } return list; } // VIO Network - Generic - List getViosNetworkGenericAdapters() { + List getVioNetworkGenericAdapters() { List list = new ArrayList<>(); + try { + metric.getSample().viosUtil.forEach( vio -> { + vio.network.genericAdapters.forEach( adapter -> { - metrics.systemUtil.sample.viosUtil.forEach( vios -> { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - vios.network.genericAdapters.forEach( adapter -> { + tagsMap.put("id", adapter.id); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVioNetworkGenericAdapters() - tags: " + tagsMap); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("id", adapter.id); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getViosNetworkGenericAdapters() - tags: {}", tagsMap); + fieldsMap.put("sentBytes", adapter.sentBytes); + fieldsMap.put("sentPackets", adapter.sentPackets); + fieldsMap.put("receivedBytes", adapter.receivedBytes); + fieldsMap.put("receivedPackets", adapter.receivedPackets); + fieldsMap.put("droppedPackets", adapter.droppedPackets); + fieldsMap.put("transferredBytes", adapter.transferredBytes); + log.trace("getVioNetworkGenericAdapters() - fields: " + fieldsMap); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("sentBytes", adapter.sentBytes); - fieldsMap.put("sentPackets", adapter.sentPackets); - fieldsMap.put("receivedBytes", adapter.receivedBytes); - fieldsMap.put("receivedPackets", adapter.receivedPackets); - fieldsMap.put("droppedPackets", adapter.droppedPackets); - fieldsMap.put("transferredBytes", adapter.transferredBytes); - log.trace("getViosNetworkGenericAdapters() - fields: {}", fieldsMap); - - list.add(new Measurement(tagsMap, fieldsMap)); + list.add(new Measurement(tagsMap, fieldsMap)); + }); }); - - }); + } catch (Exception e) { + log.warn("getVioNetworkGenericAdapters() - error: {}", e.getMessage()); + } return list; } // VIOs - Storage - List getViosStorageLpars() { + List getVioStorageLpars() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach(vios -> { + try { + metric.getSample().viosUtil.forEach(vio -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - log.trace("getViosStorageLpars() - tags: {}", tagsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("clientlpars", vios.storage.clientLpars.size()); - log.trace("getViosStorageLpars() - fields: {}", fieldsMap); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + log.trace("getVioStorageLpars() - tags: " + tagsMap); - list.add(new Measurement(tagsMap, fieldsMap)); - }); + fieldsMap.put("clientlpars", vio.storage.clientLpars.size()); + log.trace("getVioStorageLpars() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + } catch (Exception e) { + log.warn("getVioStorageLpars() - error: {}", e.getMessage()); + } return list; } // VIO Storage FC - List getViosStorageFiberChannelAdapters() { + List getVioStorageFiberChannelAdapters() { List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach( vios -> { - log.trace("getViosStorageFiberChannelAdapters() - VIOS: {}", vios.name); + try { + metric.getSample().viosUtil.forEach( vio -> { + log.trace("getVioStorageFiberChannelAdapters() - VIO: " + vio.name); - vios.storage.fiberChannelAdapters.forEach( adapter -> { + vio.storage.fiberChannelAdapters.forEach( adapter -> { - HashMap tagsMap = new HashMap<>(); - tagsMap.put("id", adapter.id); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getViosStorageFiberChannelAdapters() - tags: {}", tagsMap); + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("numOfReads", adapter.numOfReads); - fieldsMap.put("numOfWrites", adapter.numOfWrites); - fieldsMap.put("readBytes", adapter.readBytes); - fieldsMap.put("writeBytes", adapter.writeBytes); - fieldsMap.put("transmittedBytes", adapter.transmittedBytes); - log.trace("getViosStorageFiberChannelAdapters() - fields: {}", fieldsMap); + tagsMap.put("id", adapter.id); + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVioStorageFiberChannelAdapters() - tags: " + tagsMap); + + fieldsMap.put("numOfReads", adapter.numOfReads); + fieldsMap.put("numOfWrites", adapter.numOfWrites); + fieldsMap.put("readBytes", adapter.readBytes); + fieldsMap.put("writeBytes", adapter.writeBytes); + fieldsMap.put("transmittedBytes", adapter.transmittedBytes); + log.trace("getVioStorageFiberChannelAdapters() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); - list.add(new Measurement(tagsMap, fieldsMap)); }); - }); + } catch (Exception e) { + log.warn("getVioStorageFiberChannelAdapters() - error: {}", e.getMessage()); + } return list; } + + // VIO Storage - Physical + List getVioStoragePhysicalAdapters() { + + List list = new ArrayList<>(); + try { + metric.getSample().viosUtil.forEach( vio -> { + log.trace("getVioStoragePhysicalAdapters() - VIO: " + vio.name); + + vio.storage.genericPhysicalAdapters.forEach( adapter -> { + + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); + + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + tagsMap.put("id", adapter.id); + tagsMap.put("location", adapter.physicalLocation); + log.trace("getVioStoragePhysicalAdapters() - tags: " + tagsMap); + + fieldsMap.put("numOfReads", adapter.numOfReads); + fieldsMap.put("numOfWrites", adapter.numOfWrites); + fieldsMap.put("readBytes", adapter.readBytes); + fieldsMap.put("writeBytes", adapter.writeBytes); + fieldsMap.put("transmittedBytes", adapter.transmittedBytes); + fieldsMap.put("type", adapter.type); + log.trace("getVioStoragePhysicalAdapters() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + }); + } catch (Exception e) { + log.warn("getVioStoragePhysicalAdapters() - error: {}", e.getMessage()); + } + + return list; + } + + + // VIO Storage - Virtual + List getVioStorageVirtualAdapters() { + + List list = new ArrayList<>(); + try { + metric.getSample().viosUtil.forEach( (vio) -> { + vio.storage.genericVirtualAdapters.forEach( (adapter) -> { + HashMap tagsMap = new HashMap<>(); + HashMap fieldsMap = new HashMap<>(); + + tagsMap.put("servername", entry.getName()); + tagsMap.put("viosname", vio.name); + tagsMap.put("location", adapter.physicalLocation); + tagsMap.put("id", adapter.id); + log.debug("getVioStorageVirtualAdapters() - tags: " + tagsMap); + + fieldsMap.put("numOfReads", adapter.numOfReads); + fieldsMap.put("numOfWrites", adapter.numOfWrites); + fieldsMap.put("readBytes", adapter.readBytes); + fieldsMap.put("writeBytes", adapter.writeBytes); + fieldsMap.put("transmittedBytes", adapter.transmittedBytes); + fieldsMap.put("type", adapter.type); + log.debug("getVioStorageVirtualAdapters() - fields: " + fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + }); + }); + } catch (Exception e) { + log.warn("getVioStorageVirtualAdapters() - error: {}", e.getMessage()); + } + + return list; + } + + + /* // VIO Storage SSP TODO List getViosStorageSharedStoragePools() { List list = new ArrayList<>(); -/* metrics.systemUtil.sample.viosUtil.forEach( vios -> { vios.storage.fiberChannelAdapters.forEach( adapter -> { @@ -474,74 +802,10 @@ class ManagedSystem extends MetaSystem { log.trace("getViosStorageSharedStoragePools() - VIOS: " + vios.name); }); -*/ - return list; - } - - // VIO Storage - Physical - List getViosStoragePhysicalAdapters() { - - List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach( vios -> { - log.trace("getViosStoragePhysicalAdapters() - VIOS: {}", vios.name); - - vios.storage.genericPhysicalAdapters.forEach( adapter -> { - - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - tagsMap.put("id", adapter.id); - tagsMap.put("location", adapter.physicalLocation); - log.trace("getViosStoragePhysicalAdapters() - tags: {}", tagsMap); - - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("numOfReads", adapter.numOfReads); - fieldsMap.put("numOfWrites", adapter.numOfWrites); - fieldsMap.put("readBytes", adapter.readBytes); - fieldsMap.put("writeBytes", adapter.writeBytes); - fieldsMap.put("transmittedBytes", adapter.transmittedBytes); - fieldsMap.put("type", adapter.type); - log.trace("getViosStoragePhysicalAdapters() - fields: {}", fieldsMap); - - list.add(new Measurement(tagsMap, fieldsMap)); - }); - - }); return list; } + */ - // VIO Storage - Virtual - List getViosStorageVirtualAdapters() { - - List list = new ArrayList<>(); - metrics.systemUtil.sample.viosUtil.forEach( vios -> { - log.trace("getViosStorageVirtualAdapters() - VIOS: {}", vios.name); - - vios.storage.genericVirtualAdapters.forEach( adapter -> { - - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", name); - tagsMap.put("viosname", vios.name); - tagsMap.put("location", adapter.physicalLocation); - tagsMap.put("id", adapter.id); - log.trace("getViosStorageVirtualAdapters() - tags: {}", tagsMap); - - HashMap fieldsMap = new HashMap<>(); - fieldsMap.put("numOfReads", adapter.numOfReads); - fieldsMap.put("numOfWrites", adapter.numOfWrites); - fieldsMap.put("readBytes", adapter.readBytes); - fieldsMap.put("writeBytes", adapter.writeBytes); - fieldsMap.put("transmittedBytes", adapter.transmittedBytes); - fieldsMap.put("type", adapter.type); - log.trace("getViosStorageVirtualAdapters() - fields: {}", fieldsMap); - - list.add(new Measurement(tagsMap, fieldsMap)); - }); - - }); - - return list; - } } diff --git a/src/main/java/biz/nellemann/hmci/ManagementConsole.java b/src/main/java/biz/nellemann/hmci/ManagementConsole.java new file mode 100644 index 0000000..660ebc1 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/ManagementConsole.java @@ -0,0 +1,261 @@ +/* + * Copyright 2020 Mark Nellemann + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package biz.nellemann.hmci; + +import biz.nellemann.hmci.dto.toml.HmcConfiguration; +import biz.nellemann.hmci.dto.xml.Link; +import biz.nellemann.hmci.dto.xml.ManagementConsoleEntry; +import biz.nellemann.hmci.dto.xml.XmlFeed; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.time.Duration; +import java.time.Instant; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; + +import static java.lang.Thread.sleep; + +class ManagementConsole implements Runnable { + + private final static Logger log = LoggerFactory.getLogger(ManagementConsole.class); + + private final Integer refreshValue; + private final Integer discoverValue; + private final List managedSystems = new ArrayList<>(); + + + private final RestClient restClient; + private final InfluxClient influxClient; + private final AtomicBoolean keepRunning = new AtomicBoolean(true); + + protected Integer responseErrors = 0; + + private Boolean doEnergy = true; + private final List excludeSystems; + private final List includeSystems; + private final List excludePartitions; + private final List includePartitions; + + + ManagementConsole(HmcConfiguration configuration, InfluxClient influxClient) { + this.refreshValue = configuration.refresh; + this.discoverValue = configuration.discover; + this.doEnergy = configuration.energy; + this.influxClient = influxClient; + restClient = new RestClient(configuration.url, configuration.username, configuration.password, configuration.trust); + + if(configuration.trace != null) { + try { + File traceDir = new File(configuration.trace); + traceDir.mkdirs(); + if(traceDir.canWrite()) { + Boolean doTrace = true; + } else { + log.warn("HmcInstance() - can't write to trace dir: " + traceDir.toString()); + } + } catch (Exception e) { + log.error("HmcInstance() - trace error: " + e.getMessage()); + } + } + this.excludeSystems = configuration.excludeSystems; + this.includeSystems = configuration.includeSystems; + this.excludePartitions = configuration.excludePartitions; + this.includePartitions = configuration.includePartitions; + } + + + @Override + public void run() { + + log.trace("run()"); + int executions = 0; + + restClient.login(); + discover(); + + do { + Instant instantStart = Instant.now(); + try { + refresh(); + if (++executions > discoverValue) { // FIXME: Change to time based logic + executions = 0; + discover(); + } + } catch (Exception e) { + log.error("run() - fatal error: {}", e.getMessage()); + keepRunning.set(false); + throw new RuntimeException(e); + } + + Instant instantEnd = Instant.now(); + long timeSpend = Duration.between(instantStart, instantEnd).toMillis(); + log.trace("run() - duration millis: " + timeSpend); + if(timeSpend < (refreshValue * 1000)) { + try { + long sleepTime = (refreshValue * 1000) - timeSpend; + log.trace("run() - sleeping millis: " + sleepTime); + if(sleepTime > 0) { + //noinspection BusyWait + sleep(sleepTime); + } + } catch (InterruptedException e) { + log.error("run() - sleep interrupted", e); + } + } else { + log.warn("run() - possible slow response from this HMC"); + } + + } while (keepRunning.get()); + + + // Logout of HMC + restClient.logoff(); + + } + + + public void discover() { + + try { + String xml = restClient.getRequest("/rest/api/uom/ManagementConsole"); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + responseErrors++; + log.warn("discover() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlFeed xmlFeed = xmlMapper.readValue(xml, XmlFeed.class); + ManagementConsoleEntry entry; + + if(xmlFeed.getEntry() == null){ + log.warn("discover() - xmlFeed.entry == null"); + return; + } + + if(xmlFeed.getEntry().getContent().isManagementConsole()) { + entry = xmlFeed.getEntry().getContent().getManagementConsole(); + log.info("discover() - {}", entry.getName()); + } else { + throw new UnsupportedOperationException("Failed to deserialize ManagementConsole"); + } + + managedSystems.clear(); + for (Link link : entry.getAssociatedManagedSystems()) { + ManagedSystem managedSystem = new ManagedSystem(restClient, link.getHref()); + managedSystem.setExcludePartitions(excludePartitions); + managedSystem.setIncludePartitions(includePartitions); + managedSystem.setDoEnergy(doEnergy); + managedSystem.discover(); + + // Only continue for powered-on operating systems + if(managedSystem.entry != null && Objects.equals(managedSystem.entry.state, "operating")) { + + // Check exclude / include + if (!excludeSystems.contains(managedSystem.name) && includeSystems.isEmpty()) { + managedSystems.add(managedSystem); + //log.info("discover() - adding !excluded system: {}", managedSystem.name); + } else if (!includeSystems.isEmpty() && includeSystems.contains(managedSystem.name)) { + managedSystems.add(managedSystem); + //log.info("discover() - adding included system: {}", managedSystem.name); + } + } + } + + } catch (Exception e) { + log.warn("discover() - error: {}", e.getMessage()); + } + + } + + + void refresh() { + + log.debug("refresh()"); + managedSystems.forEach( (system) -> { + + if(system.entry == null){ + log.warn("refresh() - system.entry == null"); + return; + } + + system.refresh(); + + influxClient.write(system.getDetails(), system.getTimestamp(),"server_details"); + influxClient.write(system.getMemoryMetrics(), system.getTimestamp(),"server_memory"); + influxClient.write(system.getProcessorMetrics(), system.getTimestamp(),"server_processor"); + influxClient.write(system.getPhysicalProcessorPool(), system.getTimestamp(),"server_physicalProcessorPool"); + influxClient.write(system.getSharedProcessorPools(), system.getTimestamp(),"server_sharedProcessorPool"); + + if(doEnergy) { + system.systemEnergy.refresh(); + if(system.systemEnergy.metric != null) { + influxClient.write(system.systemEnergy.getPowerMetrics(), system.getTimestamp(), "server_energy_power"); + influxClient.write(system.systemEnergy.getThermalMetrics(), system.getTimestamp(), "server_energy_thermal"); + } + } + + influxClient.write(system.getVioDetails(), system.getTimestamp(),"vios_details"); + influxClient.write(system.getVioProcessorMetrics(), system.getTimestamp(),"vios_processor"); + influxClient.write(system.getVioMemoryMetrics(), system.getTimestamp(),"vios_memory"); + influxClient.write(system.getVioNetworkLpars(), system.getTimestamp(),"vios_network_lpars"); + influxClient.write(system.getVioNetworkVirtualAdapters(), system.getTimestamp(),"vios_network_virtual"); + influxClient.write(system.getVioNetworkSharedAdapters(), system.getTimestamp(),"vios_network_shared"); + influxClient.write(system.getVioNetworkGenericAdapters(), system.getTimestamp(),"vios_network_generic"); + influxClient.write(system.getVioStorageLpars(), system.getTimestamp(),"vios_storage_lpars"); + influxClient.write(system.getVioStorageFiberChannelAdapters(), system.getTimestamp(),"vios_storage_FC"); + influxClient.write(system.getVioStorageVirtualAdapters(), system.getTimestamp(),"vios_storage_vFC"); + influxClient.write(system.getVioStoragePhysicalAdapters(), system.getTimestamp(),"vios_storage_physical"); + // Missing: vios_storage_SSP + + system.logicalPartitions.forEach( (partition) -> { + partition.refresh(); + influxClient.write(partition.getDetails(), partition.getTimestamp(),"lpar_details"); + influxClient.write(partition.getMemoryMetrics(), partition.getTimestamp(),"lpar_memory"); + influxClient.write(partition.getProcessorMetrics(), partition.getTimestamp(),"lpar_processor"); + influxClient.write(partition.getSriovLogicalPorts(), partition.getTimestamp(),"lpar_net_sriov"); + influxClient.write(partition.getVirtualEthernetAdapterMetrics(), partition.getTimestamp(),"lpar_net_virtual"); + influxClient.write(partition.getVirtualGenericAdapterMetrics(), partition.getTimestamp(),"lpar_storage_virtual"); + influxClient.write(partition.getVirtualFibreChannelAdapterMetrics(), partition.getTimestamp(),"lpar_storage_vFC"); + }); + + }); + + } + + + /* + private void writeTraceFile(String id, String json) { + + String fileName = String.format("%s-%s.json", id, Instant.now().toString()); + try { + log.debug("Writing trace file: " + fileName); + File traceFile = new File(traceDir, fileName); + BufferedWriter writer = new BufferedWriter(new FileWriter(traceFile)); + writer.write(json); + writer.close(); + } catch (IOException e) { + log.warn("writeTraceFile() - " + e.getMessage()); + } + } + */ + +} diff --git a/src/main/java/biz/nellemann/hmci/MetaSystem.java b/src/main/java/biz/nellemann/hmci/MetaSystem.java deleted file mode 100644 index d1ea163..0000000 --- a/src/main/java/biz/nellemann/hmci/MetaSystem.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2020 Mark Nellemann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package biz.nellemann.hmci; - -import biz.nellemann.hmci.pcm.PcmData; -import com.serjltt.moshi.adapters.FirstElement; -import com.squareup.moshi.FromJson; -import com.squareup.moshi.JsonAdapter; -import com.squareup.moshi.Moshi; -import com.squareup.moshi.ToJson; -import java.io.IOException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.math.BigDecimal; -import java.time.Instant; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; - -abstract class MetaSystem { - - private final static Logger log = LoggerFactory.getLogger(MetaSystem.class); - - private final JsonAdapter jsonAdapter; - - protected PcmData metrics; - - MetaSystem() { - try { - Moshi moshi = new Moshi.Builder().add(new NumberAdapter()).add(new BigDecimalAdapter()).add(FirstElement.ADAPTER_FACTORY).build(); - jsonAdapter = moshi.adapter(PcmData.class); - } catch(Exception e) { - log.warn("MetaSystem() error", e); - throw new ExceptionInInitializerError(e); - } - } - - - void processMetrics(String json) { - - try { - metrics = jsonAdapter.nullSafe().fromJson(json); - } catch(IOException e) { - log.warn("processMetrics() error", e); - } - //System.out.println(jsonAdapter.toJson(metrics)); - - } - - - Instant getTimestamp() { - - String timestamp = getStringMetricObject(metrics.systemUtil.sample.sampleInfo.timeStamp); - Instant instant = Instant.now(); - try { - log.trace("getTimeStamp() - PMC Timestamp: {}", timestamp); - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[XXX][X]"); - instant = Instant.from(dateTimeFormatter.parse(timestamp)); - log.trace("getTimestamp() - Instant: {}", instant.toString()); - } catch(DateTimeParseException e) { - log.warn("getTimestamp() - parse error: {}", timestamp); - } - - return instant; - } - - - String getStringMetricObject(Object obj) { - String metric = null; - try { - metric = (String) obj; - } catch (NullPointerException npe) { - log.warn("getStringMetricObject()", npe); - } - - return metric; - } - - - Number getNumberMetricObject(Object obj) { - Number metric = null; - try { - metric = (Number) obj; - } catch (NullPointerException npe) { - log.warn("getNumberMetricObject()", npe); - } - - return metric; - } - - - static class BigDecimalAdapter { - - @FromJson - BigDecimal fromJson(String string) { - return new BigDecimal(string); - } - - @ToJson - String toJson(BigDecimal value) { - return value.toString(); - } - } - - - static class NumberAdapter { - - @FromJson - Number fromJson(String string) { - return Double.parseDouble(string); - } - - @ToJson - String toJson(Number value) { - return value.toString(); - } - } - -} - diff --git a/src/main/java/biz/nellemann/hmci/Resource.java b/src/main/java/biz/nellemann/hmci/Resource.java new file mode 100644 index 0000000..b603cc4 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/Resource.java @@ -0,0 +1,64 @@ +package biz.nellemann.hmci; + +import biz.nellemann.hmci.dto.json.ProcessedMetrics; +import biz.nellemann.hmci.dto.json.SystemUtil; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +public class Resource { + + private final static Logger log = LoggerFactory.getLogger(Resource.class); + + private final ObjectMapper objectMapper = new ObjectMapper(); + + protected SystemUtil metric; + + + Resource() { + objectMapper.enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); + objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + } + + + void deserialize(String json) { + if(json == null || json.length() < 1) { + return; + } + + try { + ProcessedMetrics processedMetrics = objectMapper.readValue(json, ProcessedMetrics.class); + metric = processedMetrics.systemUtil; + } catch (Exception e) { + log.error("deserialize() - error: {}", e.getMessage()); + } + } + + + Instant getTimestamp() { + Instant instant = Instant.now(); + + if (metric == null) { + return instant; + } + + String timestamp = metric.getSample().sampleInfo.timestamp; + try { + log.trace("getTimeStamp() - PMC Timestamp: {}", timestamp); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[XXX][X]"); + instant = Instant.from(dateTimeFormatter.parse(timestamp)); + log.trace("getTimestamp() - Instant: {}", instant.toString()); + } catch(DateTimeParseException e) { + log.warn("getTimestamp() - parse error: {}", timestamp); + } + + return instant; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/RestClient.java b/src/main/java/biz/nellemann/hmci/RestClient.java new file mode 100644 index 0000000..0902c4c --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/RestClient.java @@ -0,0 +1,295 @@ +package biz.nellemann.hmci; + +import biz.nellemann.hmci.dto.xml.LogonResponse; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import okhttp3.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.*; +import java.net.*; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +public class RestClient { + + private final static Logger log = LoggerFactory.getLogger(RestClient.class); + private final MediaType MEDIA_TYPE_IBM_XML_LOGIN = MediaType.parse("application/vnd.ibm.powervm.web+xml; type=LogonRequest"); + + + protected OkHttpClient httpClient; + + // OkHttpClient timeouts + private final static int CONNECT_TIMEOUT = 30; + private final static int WRITE_TIMEOUT = 30; + private final static int READ_TIMEOUT = 180; + + //protected final HttpClient httpClient; + protected String authToken; + + protected final String baseUrl; + protected final String username; + protected final String password; + + + public RestClient(String baseUrl, String username, String password, Boolean trustAll) { + this.baseUrl = baseUrl; + this.username = username; + this.password = password; + //this.httpClient = getHttpClient(trustAll); + //httpClient.start(); + if (trustAll) { + this.httpClient = getUnsafeOkHttpClient(); + } else { + this.httpClient = getSafeOkHttpClient(); + } + } + + + /** + * Logon to the HMC and get an authentication token for further requests. + */ + public synchronized void login() { + + log.info("Connecting to HMC - {} @ {}", username, baseUrl); + StringBuilder payload = new StringBuilder(); + payload.append(""); + payload.append(""); + payload.append("").append(username).append(""); + payload.append("").append(password).append(""); + payload.append(""); + + try { + //httpClient.start(); + URL url = new URL(String.format("%s/rest/api/web/Logon", baseUrl)); + Request request = new Request.Builder() + .url(url) + .addHeader("Accept", "application/vnd.ibm.powervm.web+xml; type=LogonResponse") + .addHeader("X-Audit-Memento", "IBM Power HMC Insights") + .put(RequestBody.create(payload.toString(), MEDIA_TYPE_IBM_XML_LOGIN)) + .build(); + + String responseBody; + try (Response response = httpClient.newCall(request).execute()) { + responseBody = Objects.requireNonNull(response.body()).string(); + if (!response.isSuccessful()) { + log.warn("login() - Unexpected response: {}", response.code()); + throw new IOException("Unexpected code: " + response); + } + } + + XmlMapper xmlMapper = new XmlMapper(); + LogonResponse logonResponse = xmlMapper.readValue(responseBody, LogonResponse.class); + + authToken = logonResponse.getToken(); + log.debug("logon() - auth token: {}", authToken); + + } catch (Exception e) { + log.warn("logon() - error: {}", e.getMessage()); + } + + } + + + /** + * Logoff from the HMC and remove any session + * + */ + synchronized void logoff() { + + if(authToken == null) { + return; + } + + try { + + URL url = new URL(String.format("%s/rest/api/web/Logon", baseUrl)); + Request request = new Request.Builder() + .url(url) + .addHeader("Content-Type", "application/vnd.ibm.powervm.web+xml; type=LogonRequest") + .addHeader("X-API-Session", authToken) + .delete() + .build(); + + String responseBody; + try (Response response = httpClient.newCall(request).execute()) { + responseBody = Objects.requireNonNull(response.body()).string(); + } catch (IOException e) { + log.warn("logoff() error: {}", e.getMessage()); + } finally { + authToken = null; + } + + } catch (MalformedURLException e) { + log.warn("logoff() - error: {}", e.getMessage()); + } + + } + + + public String getRequest(String urlPath) throws IOException { + URL absUrl = new URL(String.format("%s%s", baseUrl, urlPath)); + return getRequest(absUrl); + } + + public String postRequest(String urlPath, String payload) throws IOException { + URL absUrl = new URL(String.format("%s%s", baseUrl, urlPath)); + return postRequest(absUrl, payload); + } + + + /** + * Return a Response from the HMC + * @param url to get Response from + * @return Response body string + */ + private String getRequest(URL url) throws IOException { + + log.trace("getRequest() - URL: {}", url.toString()); + + Request request = new Request.Builder() + .url(url) + .addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") + .addHeader("X-API-Session", (authToken == null ? "" : authToken)) + .get().build(); + + String responseBody; + try (Response response = httpClient.newCall(request).execute()) { + + responseBody = Objects.requireNonNull(response.body()).string();; + if (!response.isSuccessful()) { + + // Auth. failure + if(response.code() == 401) { + log.warn("getRequest() - 401 - login and retry."); + + // Let's login again and retry + authToken = null; + login(); + + try (Response responseRetry = httpClient.newCall(request).execute()) { + log.debug("getRequest() - in retry: {}", Objects.requireNonNull(responseRetry.body()).string()); + if (responseRetry.isSuccessful()) { + return Objects.requireNonNull(responseRetry.body()).string(); + } + return null; + } + } + + log.error("getRequest() - Unexpected response: {}", response.code()); + throw new IOException("getRequest() - Unexpected response: " + response.code()); + } + + } + + return responseBody; + } + + + /** + * Send a POST request with a payload (can be null) to the HMC + * @param url + * @param payload + * @return + * @throws IOException + */ + public String postRequest(URL url, String payload) throws IOException { + + log.trace("sendPostRequest() - URL: {}", url.toString()); + RequestBody requestBody; + if(payload != null) { + requestBody = RequestBody.create(payload, MediaType.get("application/xml")); + } else { + requestBody = RequestBody.create("", null); + } + + Request request = new Request.Builder() + .url(url) + //.addHeader("Content-Type", "application/xml") + .addHeader("content-type", "application/xml") + .addHeader("X-API-Session", (authToken == null ? "" : authToken) ) + .post(requestBody).build(); + + String responseBody; + try (Response response = httpClient.newCall(request).execute()) { + responseBody = Objects.requireNonNull(response.body()).string(); + + if (!response.isSuccessful()) { + response.close(); + log.warn(responseBody); + log.error("sendPostRequest() - Unexpected response: {}", response.code()); + throw new IOException("sendPostRequest() - Unexpected response: " + response.code()); + } + } + + return responseBody; + } + + + /** + * Provide an unsafe (ignoring SSL problems) OkHttpClient + * + * @return OkHttpClient ignoring SSL/TLS errors + */ + private static OkHttpClient getUnsafeOkHttpClient() { + try { + // Create a trust manager that does not validate certificate chains + final TrustManager[] trustAllCerts = new TrustManager[] { + new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; + } + } + }; + + // Install the all-trusting trust manager + final SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init(null, trustAllCerts, new SecureRandom()); + + // Create a ssl socket factory with our all-trusting manager + final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); + + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0]); + builder.hostnameVerifier((hostname, session) -> true); + builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS); + builder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS); + builder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); + + return builder.build(); + } catch (KeyManagementException | NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + + /** + * Get OkHttpClient with our preferred timeout values. + * @return OkHttpClient + */ + private static OkHttpClient getSafeOkHttpClient() { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS); + builder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS); + builder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); + return builder.build(); + } + + +} diff --git a/src/main/java/biz/nellemann/hmci/SystemEnergy.java b/src/main/java/biz/nellemann/hmci/SystemEnergy.java index 50a3b53..e4cf1bf 100644 --- a/src/main/java/biz/nellemann/hmci/SystemEnergy.java +++ b/src/main/java/biz/nellemann/hmci/SystemEnergy.java @@ -1,60 +1,107 @@ -/* - * Copyright 2020 Mark Nellemann - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package biz.nellemann.hmci; -import biz.nellemann.hmci.pcm.Temperature; +import biz.nellemann.hmci.dto.xml.Link; +import biz.nellemann.hmci.dto.xml.XmlFeed; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.IOException; +import java.net.URI; +import java.util.*; -class SystemEnergy extends MetaSystem { +class SystemEnergy extends Resource { private final static Logger log = LoggerFactory.getLogger(SystemEnergy.class); - public final ManagedSystem system; + private final RestClient restClient; + private final ManagedSystem managedSystem; + + protected String id; + protected String name; - SystemEnergy(ManagedSystem system) { - this.system = system; + public SystemEnergy(RestClient restClient, ManagedSystem managedSystem) { + log.debug("SystemEnergy()"); + this.restClient = restClient; + this.managedSystem = managedSystem; } - @Override - public String toString() { - return system.name; + public void refresh() { + + log.debug("refresh()"); + try { + String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?Type=Energy&NoOfSamples=1", managedSystem.id)); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("refresh() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlFeed xmlFeed = xmlMapper.readValue(xml, XmlFeed.class); + + xmlFeed.entries.forEach((entry) -> { + if (entry.category.term.equals("ManagedSystem")) { + Link link = entry.link; + if (link.getType() != null && Objects.equals(link.getType(), "application/json")) { + try { + URI jsonUri = URI.create(link.getHref()); + String json = restClient.getRequest(jsonUri.getPath()); + deserialize(json); + } catch (IOException e) { + log.error("refresh() - error 1: {}", e.getMessage()); + } + } + } + }); + + } catch (IOException e) { + log.error("refresh() - error: {} {}", e.getClass(), e.getMessage()); + } + + + /* + try { + Document doc = Jsoup.parse(responseBody); + Element entry = doc.select("feed > entry").first(); + Element link = Objects.requireNonNull(entry).select("link[href]").first(); + + if(Objects.requireNonNull(link).attr("type").equals("application/json")) { + String href = link.attr("href"); + log.trace("getPcmDataForEnergy() - URL: {}", href); + jsonBody = sendGetRequest(new URL(href)); + } + + } catch(Exception e) { + log.warn("getPcmDataForEnergy() - XML parse error: {}", systemEnergy, e); + } + */ } + + List getPowerMetrics() { List list = new ArrayList<>(); + try { + HashMap tagsMap = new HashMap<>(); + Map fieldsMap = new HashMap<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - log.trace("getPowerMetrics() - tags: {}", tagsMap); + tagsMap.put("servername", managedSystem.name); + log.trace("getPowerMetrics() - tags: {}", tagsMap); - Map fieldsMap = new HashMap<>(); - fieldsMap.put("powerReading", metrics.systemUtil.sample.energyUtil.powerUtil.powerReading); - log.trace("getPowerMetrics() - fields: {}", fieldsMap); + fieldsMap.put("powerReading", metric.getSample().energyUtil.powerUtil.powerReading); + log.trace("getPowerMetrics() - fields: {}", fieldsMap); + + list.add(new Measurement(tagsMap, fieldsMap)); + } catch (Exception e) { + log.warn("getPowerMetrics() - error: {}", e.getMessage()); + } - list.add(new Measurement(tagsMap, fieldsMap)); return list; } @@ -62,28 +109,36 @@ class SystemEnergy extends MetaSystem { List getThermalMetrics() { List list = new ArrayList<>(); + try { + HashMap tagsMap = new HashMap<>(); + Map fieldsMap = new HashMap<>(); - HashMap tagsMap = new HashMap<>(); - tagsMap.put("servername", system.name); - log.trace("getThermalMetrics() - tags: {}", tagsMap); + tagsMap.put("servername", managedSystem.name); + log.trace("getThermalMetrics() - tags: {}", tagsMap); - Map fieldsMap = new HashMap<>(); + metric.getSample().energyUtil.thermalUtil.cpuTemperatures.forEach((t) -> { + fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading); + }); - for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures) { - fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading); + metric.getSample().energyUtil.thermalUtil.inletTemperatures.forEach((t) -> { + fieldsMap.put("inletTemperature_" + t.entityInstance, t.temperatureReading); + }); + + /* Disabled, not sure if useful + for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures) { + fieldsMap.put("baseboardTemperature_" + t.entityInstance, t.temperatureReading); + }*/ + log.trace("getThermalMetrics() - fields: {}", fieldsMap); + + + list.add(new Measurement(tagsMap, fieldsMap)); + + } catch (Exception e) { + log.warn("getThermalMetrics() - error: {}", e.getMessage()); } - for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.inletTemperatures) { - fieldsMap.put("inletTemperature_" + t.entityInstance, t.temperatureReading); - } - - /* Disabled, not sure if useful - for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures) { - fieldsMap.put("baseboardTemperature_" + t.entityInstance, t.temperatureReading); - }*/ - - log.trace("getThermalMetrics() - fields: {}", fieldsMap); - list.add(new Measurement(tagsMap, fieldsMap)); return list; } + } + diff --git a/src/main/java/biz/nellemann/hmci/VirtualIOServer.java b/src/main/java/biz/nellemann/hmci/VirtualIOServer.java new file mode 100644 index 0000000..62a94ee --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/VirtualIOServer.java @@ -0,0 +1,66 @@ +package biz.nellemann.hmci; + +import biz.nellemann.hmci.dto.xml.VirtualIOServerEntry; +import biz.nellemann.hmci.dto.xml.XmlEntry; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URI; +import java.net.URISyntaxException; + +public class VirtualIOServer { + private final static Logger log = LoggerFactory.getLogger(VirtualIOServer.class); + + private final RestClient restClient; + private final ManagedSystem managedSystem; + + protected String id; + private String uriPath; + protected VirtualIOServerEntry entry; + + + public VirtualIOServer(RestClient restClient, String href, ManagedSystem system) { + log.debug("VirtualIOServer() - {}", href); + this.restClient = restClient; + this.managedSystem = system; + try { + URI uri = new URI(href); + uriPath = uri.getPath(); + //refresh(); + } catch (URISyntaxException e) { + log.error("VirtualIOServer() - {}", e.getMessage()); + } + } + + public void discover() { + try { + String xml = restClient.getRequest(uriPath); + + // Do not try to parse empty response + if(xml == null || xml.length() <= 1) { + log.warn("discover() - no data."); + return; + } + + XmlMapper xmlMapper = new XmlMapper(); + XmlEntry xmlEntry = xmlMapper.readValue(xml, XmlEntry.class); + + if(xmlEntry.getContent() == null){ + log.warn("discover() - no content."); + return; + } + + if(xmlEntry.getContent().isVirtualIOServer()) { + entry = xmlEntry.getContent().getVirtualIOServerEntry(); + log.debug("discover() - {}", entry.getName()); + } else { + throw new UnsupportedOperationException("Failed to deserialize VirtualIOServer"); + } + + } catch (Exception e) { + log.error("discover() - error: {}", e.getMessage()); + } + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/EnergyUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/EnergyUtil.java new file mode 100644 index 0000000..89ba619 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/EnergyUtil.java @@ -0,0 +1,8 @@ +package biz.nellemann.hmci.dto.json; + +public final class EnergyUtil { + + public PowerUtil powerUtil = new PowerUtil(); + public ThermalUtil thermalUtil = new ThermalUtil(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/FiberChannelAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/FiberChannelAdapter.java new file mode 100644 index 0000000..225e98d --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/FiberChannelAdapter.java @@ -0,0 +1,22 @@ +package biz.nellemann.hmci.dto.json; + + +/** + * Storage adapter + */ + +public final class FiberChannelAdapter { + + public String id; + public String wwpn; + public String physicalLocation; + + public int numOfPorts; + public double numOfReads; + public double numOfWrites; + public double readBytes; + public double writeBytes; + public double runningSpeed; + public double transmittedBytes; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/GenericAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/GenericAdapter.java new file mode 100644 index 0000000..eaf0015 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/GenericAdapter.java @@ -0,0 +1,16 @@ +package biz.nellemann.hmci.dto.json; + + +public final class GenericAdapter { + + public String id; + public String type = ""; + public String physicalLocation = ""; + public double receivedPackets = 0.0; + public double sentPackets = 0.0; + public double droppedPackets = 0.0; + public double sentBytes = 0.0; + public double receivedBytes = 0.0; + public double transferredBytes = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/GenericPhysicalAdapters.java b/src/main/java/biz/nellemann/hmci/dto/json/GenericPhysicalAdapters.java new file mode 100644 index 0000000..4d50741 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/GenericPhysicalAdapters.java @@ -0,0 +1,15 @@ +package biz.nellemann.hmci.dto.json; + + +public final class GenericPhysicalAdapters { + + public String id; + public String type; + public String physicalLocation; + public double numOfReads; + public double numOfWrites; + public double readBytes; + public double writeBytes; + public double transmittedBytes; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/GenericVirtualAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/GenericVirtualAdapter.java new file mode 100644 index 0000000..c0dafae --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/GenericVirtualAdapter.java @@ -0,0 +1,22 @@ +package biz.nellemann.hmci.dto.json; + + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Storage adapter + */ + +public final class GenericVirtualAdapter { + + public String id = ""; + public String type = ""; + public Integer viosId = 0; + public String physicalLocation = ""; + public Double numOfReads = 0.0; + public Double numOfWrites = 0.0; + public Double readBytes = 0.0; + public Double writeBytes = 0.0; + public Double transmittedBytes = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/LparMemory.java b/src/main/java/biz/nellemann/hmci/dto/json/LparMemory.java new file mode 100644 index 0000000..8809df6 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/LparMemory.java @@ -0,0 +1,12 @@ +package biz.nellemann.hmci.dto.json; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public final class LparMemory { + + public Double logicalMem; + public Double utilizedMem = 0.0; + public Double backedPhysicalMem = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/LparProcessor.java b/src/main/java/biz/nellemann/hmci/dto/json/LparProcessor.java new file mode 100644 index 0000000..d5e0515 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/LparProcessor.java @@ -0,0 +1,21 @@ +package biz.nellemann.hmci.dto.json; + + +public final class LparProcessor { + + public Integer poolId = 0; + public Integer weight = 0; + public String mode = ""; + public Double maxVirtualProcessors = 0.0; + public Double currentVirtualProcessors = 0.0; + public Double maxProcUnits = 0.0; + public Double entitledProcUnits = 0.0; + public Double utilizedProcUnits = 0.0; + public Double utilizedCappedProcUnits = 0.0; + public Double utilizedUncappedProcUnits = 0.0; + public Double idleProcUnits = 0.0; + public Double donatedProcUnits = 0.0; + public Double timeSpentWaitingForDispatch = 0.0; + public Double timePerInstructionExecution = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/LparUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/LparUtil.java similarity index 70% rename from src/main/java/biz/nellemann/hmci/pcm/LparUtil.java rename to src/main/java/biz/nellemann/hmci/dto/json/LparUtil.java index 81af1dc..fd51d3f 100644 --- a/src/main/java/biz/nellemann/hmci/pcm/LparUtil.java +++ b/src/main/java/biz/nellemann/hmci/dto/json/LparUtil.java @@ -1,5 +1,8 @@ -package biz.nellemann.hmci.pcm; +package biz.nellemann.hmci.dto.json; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) public final class LparUtil { public Integer id = 0; @@ -8,7 +11,7 @@ public final class LparUtil { public String state = ""; public String type = ""; public String osType = ""; - public Number affinityScore = 0.0f; + public Float affinityScore = 0.0f; public final LparMemory memory = new LparMemory(); public final LparProcessor processor = new LparProcessor(); diff --git a/src/main/java/biz/nellemann/hmci/dto/json/Network.java b/src/main/java/biz/nellemann/hmci/dto/json/Network.java new file mode 100644 index 0000000..b8595bc --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/Network.java @@ -0,0 +1,16 @@ +package biz.nellemann.hmci.dto.json; + + +import java.util.ArrayList; +import java.util.List; + +public final class Network { + + public List clientLpars = new ArrayList<>(); + public List genericAdapters = new ArrayList<>(); + public List sharedAdapters = new ArrayList<>(); + public List virtualEthernetAdapters = new ArrayList<>(); + public List sriovAdapters = new ArrayList<>(); + public List sriovLogicalPorts = new ArrayList<>(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/PhysicalProcessorPool.java b/src/main/java/biz/nellemann/hmci/dto/json/PhysicalProcessorPool.java new file mode 100644 index 0000000..3785fd1 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/PhysicalProcessorPool.java @@ -0,0 +1,12 @@ +package biz.nellemann.hmci.dto.json; + + +public final class PhysicalProcessorPool { + + public double assignedProcUnits = 0.0; + public double utilizedProcUnits = 0.0; + public double availableProcUnits = 0.0; + public double configuredProcUnits = 0.0; + public double borrowedProcUnits = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/PowerUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/PowerUtil.java new file mode 100644 index 0000000..8c4b58f --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/PowerUtil.java @@ -0,0 +1,7 @@ +package biz.nellemann.hmci.dto.json; + +public final class PowerUtil { + + public Number powerReading = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ProcessedMetrics.java b/src/main/java/biz/nellemann/hmci/dto/json/ProcessedMetrics.java new file mode 100644 index 0000000..1fc6fd9 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ProcessedMetrics.java @@ -0,0 +1,7 @@ +package biz.nellemann.hmci.dto.json; + +public class ProcessedMetrics { + + public SystemUtil systemUtil; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SRIOVAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVAdapter.java new file mode 100644 index 0000000..c41cace --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVAdapter.java @@ -0,0 +1,11 @@ +package biz.nellemann.hmci.dto.json; + +import java.util.List; + +public final class SRIOVAdapter { + + public String drcIndex = ""; + + public List physicalPorts; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SRIOVLogicalPort.java b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVLogicalPort.java new file mode 100644 index 0000000..0c63f8c --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVLogicalPort.java @@ -0,0 +1,21 @@ +package biz.nellemann.hmci.dto.json; + +public class SRIOVLogicalPort { + + public String drcIndex; + public String physicalLocation; + public String physicalDrcIndex; + public Number physicalPortId; + public String clientPartitionUUID; + public String vnicDeviceMode; + public String configurationType; + public Number receivedPackets; + public Number sentPackets; + public Number droppedPackets; + public Number sentBytes; + public Number receivedBytes; + public Number errorIn; + public Number errorOut; + public Number transferredBytes; + +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SriovLogicalPort.java b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVPhysicalPort.java similarity index 66% rename from src/main/java/biz/nellemann/hmci/pcm/SriovLogicalPort.java rename to src/main/java/biz/nellemann/hmci/dto/json/SRIOVPhysicalPort.java index 5a0d273..d31fabd 100644 --- a/src/main/java/biz/nellemann/hmci/pcm/SriovLogicalPort.java +++ b/src/main/java/biz/nellemann/hmci/dto/json/SRIOVPhysicalPort.java @@ -1,44 +1,20 @@ -package biz.nellemann.hmci.pcm; +package biz.nellemann.hmci.dto.json; -import com.serjltt.moshi.adapters.FirstElement; - -public class SriovLogicalPort { - - public String drcIndex = ""; +public final class SRIOVPhysicalPort { + public String id; public String physicalLocation = ""; // "U78CA.001.CSS0CXA-P1-C2-C1-T1-S2" - public String physicalDrcIndex = ""; - public Number physicalPortId = 0; - public String vnicDeviceMode = ""; // "NonVNIC" - public String configurationType = ""; // "Ethernet" - - - @FirstElement public Number receivedPackets = 0.0; - - @FirstElement public Number sentPackets = 0.0; - - @FirstElement public Number droppedPackets = 0.0; - - @FirstElement public Number sentBytes = 0.0; - - @FirstElement public Number receivedBytes = 0.0; - - @FirstElement public Number errorIn = 0.0; - - @FirstElement public Number errorOut = 0.0; - - @FirstElement public Number transferredBytes = 0.0; } diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SampleInfo.java b/src/main/java/biz/nellemann/hmci/dto/json/SampleInfo.java new file mode 100644 index 0000000..e9576e6 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SampleInfo.java @@ -0,0 +1,29 @@ +package biz.nellemann.hmci.dto.json; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public final class SampleInfo { + + @JsonProperty("timeStamp") + public String timestamp ; + public String getTimeStamp() { + return timestamp; + } + + public Integer status ; + + @JsonProperty("errorInfo") + public List errors; + + static class ErrorInfo { + public String errId; + public String errMsg; + public String uuid; + public String reportedBy; + public Integer occurrenceCount; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ServerMemory.java b/src/main/java/biz/nellemann/hmci/dto/json/ServerMemory.java new file mode 100644 index 0000000..d370508 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ServerMemory.java @@ -0,0 +1,11 @@ +package biz.nellemann.hmci.dto.json; + +public final class ServerMemory { + + public double totalMem = 0.0; + public double availableMem = 0.0; + public double configurableMem = 0.0; + public double assignedMemToLpars = 0.0; + public double virtualPersistentMem = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ServerProcessor.java b/src/main/java/biz/nellemann/hmci/dto/json/ServerProcessor.java new file mode 100644 index 0000000..bf91dc9 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ServerProcessor.java @@ -0,0 +1,10 @@ +package biz.nellemann.hmci.dto.json; + +public final class ServerProcessor { + + public Double totalProcUnits = 0.0; + public Double utilizedProcUnits = 0.0; + public Double availableProcUnits = 0.0; + public Double configurableProcUnits = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ServerUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/ServerUtil.java new file mode 100644 index 0000000..b6158de --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ServerUtil.java @@ -0,0 +1,15 @@ +package biz.nellemann.hmci.dto.json; + + +import java.util.ArrayList; +import java.util.List; + +public final class ServerUtil { + + public final ServerProcessor processor = new ServerProcessor(); + public final ServerMemory memory = new ServerMemory(); + public PhysicalProcessorPool physicalProcessorPool = new PhysicalProcessorPool(); + public List sharedProcessorPool = new ArrayList<>(); + public Network network = new Network(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SharedAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/SharedAdapter.java new file mode 100644 index 0000000..b1c0f72 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SharedAdapter.java @@ -0,0 +1,25 @@ +package biz.nellemann.hmci.dto.json; + + +import java.util.List; + +/** + * Network adapter + */ + +public final class SharedAdapter { + + public String id; + public String type; + public String physicalLocation; + + public double receivedPackets; + public double sentPackets; + public double droppedPackets; + public double sentBytes; + public double receivedBytes; + public double transferredBytes; + + public List bridgedAdapters; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SharedProcessorPool.java b/src/main/java/biz/nellemann/hmci/dto/json/SharedProcessorPool.java new file mode 100644 index 0000000..d383b32 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SharedProcessorPool.java @@ -0,0 +1,15 @@ +package biz.nellemann.hmci.dto.json; + + +public final class SharedProcessorPool { + + public int id; + public String name; + + public double assignedProcUnits = 0.0; + public double utilizedProcUnits = 0.0; + public double availableProcUnits = 0.0; + public double configuredProcUnits = 0.0; + public double borrowedProcUnits = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/Storage.java b/src/main/java/biz/nellemann/hmci/dto/json/Storage.java new file mode 100644 index 0000000..4a3355e --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/Storage.java @@ -0,0 +1,15 @@ +package biz.nellemann.hmci.dto.json; + + +import java.util.ArrayList; +import java.util.List; + +public final class Storage { + + public List clientLpars = new ArrayList<>(); + public List genericPhysicalAdapters = new ArrayList<>(); + public List genericVirtualAdapters = new ArrayList<>(); + public List fiberChannelAdapters = new ArrayList<>(); + public List virtualFiberChannelAdapters = new ArrayList<>(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SystemFirmware.java b/src/main/java/biz/nellemann/hmci/dto/json/SystemFirmware.java new file mode 100644 index 0000000..f34885f --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SystemFirmware.java @@ -0,0 +1,14 @@ +package biz.nellemann.hmci.dto.json; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonUnwrapped; + +public final class SystemFirmware { + + @JsonUnwrapped + public Double utilizedProcUnits;// = 0.0; + + public Double assignedMem = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/SystemUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/SystemUtil.java new file mode 100644 index 0000000..ed24092 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/SystemUtil.java @@ -0,0 +1,24 @@ +package biz.nellemann.hmci.dto.json; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import java.util.List; + +public final class SystemUtil { + + @JsonProperty("utilInfo") + public UtilInfo utilInfo; + + public UtilInfo getUtilInfo() { + return utilInfo; + } + + @JsonUnwrapped + @JsonProperty("utilSamples") + public List samples; + + public UtilSample getSample() { + return samples.size() > 0 ? samples.get(0) : new UtilSample(); + } + +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/Temperature.java b/src/main/java/biz/nellemann/hmci/dto/json/Temperature.java similarity index 60% rename from src/main/java/biz/nellemann/hmci/pcm/Temperature.java rename to src/main/java/biz/nellemann/hmci/dto/json/Temperature.java index e7b74b2..5a0c594 100644 --- a/src/main/java/biz/nellemann/hmci/pcm/Temperature.java +++ b/src/main/java/biz/nellemann/hmci/dto/json/Temperature.java @@ -1,13 +1,9 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; +package biz.nellemann.hmci.dto.json; public final class Temperature { public String entityId = ""; public String entityInstance = ""; - - @FirstElement public Number temperatureReading = 0.0; } diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ThermalUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/ThermalUtil.java new file mode 100644 index 0000000..1b22748 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ThermalUtil.java @@ -0,0 +1,12 @@ +package biz.nellemann.hmci.dto.json; + +import java.util.ArrayList; +import java.util.List; + +public final class ThermalUtil { + + public List inletTemperatures = new ArrayList<>(); + public List cpuTemperatures = new ArrayList<>(); + public List baseboardTemperatures = new ArrayList<>(); + +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/UtilInfo.java b/src/main/java/biz/nellemann/hmci/dto/json/UtilInfo.java similarity index 67% rename from src/main/java/biz/nellemann/hmci/pcm/UtilInfo.java rename to src/main/java/biz/nellemann/hmci/dto/json/UtilInfo.java index 8d655f5..4143cb3 100644 --- a/src/main/java/biz/nellemann/hmci/pcm/UtilInfo.java +++ b/src/main/java/biz/nellemann/hmci/dto/json/UtilInfo.java @@ -1,7 +1,8 @@ -package biz.nellemann.hmci.pcm; +package biz.nellemann.hmci.dto.json; -import com.serjltt.moshi.adapters.FirstElement; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +@JsonIgnoreProperties({ "metricArrayOrder" }) public final class UtilInfo { public String version = ""; @@ -13,7 +14,4 @@ public final class UtilInfo { public String name = ""; public String uuid = ""; - @FirstElement - public String metricArrayOrder = ""; - } diff --git a/src/main/java/biz/nellemann/hmci/dto/json/UtilSample.java b/src/main/java/biz/nellemann/hmci/dto/json/UtilSample.java new file mode 100644 index 0000000..eed2127 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/UtilSample.java @@ -0,0 +1,30 @@ +package biz.nellemann.hmci.dto.json; + + +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; + +public final class UtilSample { + + public String sampleType = ""; + + @JsonProperty("sampleInfo") + public SampleInfo sampleInfo = new SampleInfo(); + + public SampleInfo getInfo() { + return sampleInfo; + } + + + @JsonProperty("systemFirmwareUtil") + public SystemFirmware systemFirmwareUtil = new SystemFirmware(); + + public ServerUtil serverUtil = new ServerUtil(); + public EnergyUtil energyUtil = new EnergyUtil(); + public List viosUtil = new ArrayList<>(); + public LparUtil lparsUtil = new LparUtil(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/ViosMemory.java b/src/main/java/biz/nellemann/hmci/dto/json/ViosMemory.java new file mode 100644 index 0000000..5b3145d --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/ViosMemory.java @@ -0,0 +1,7 @@ +package biz.nellemann.hmci.dto.json; + +public final class ViosMemory { + public double assignedMem; + public double utilizedMem; + public double virtualPersistentMem; +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ViosUtil.java b/src/main/java/biz/nellemann/hmci/dto/json/ViosUtil.java similarity index 80% rename from src/main/java/biz/nellemann/hmci/pcm/ViosUtil.java rename to src/main/java/biz/nellemann/hmci/dto/json/ViosUtil.java index e46e991..ed7a1ff 100644 --- a/src/main/java/biz/nellemann/hmci/pcm/ViosUtil.java +++ b/src/main/java/biz/nellemann/hmci/dto/json/ViosUtil.java @@ -1,9 +1,9 @@ -package biz.nellemann.hmci.pcm; +package biz.nellemann.hmci.dto.json; public final class ViosUtil { - public String id = ""; - public String uuid = ""; + public int id; + public String uuid; public String name = ""; public String state = ""; public Integer affinityScore = 0; diff --git a/src/main/java/biz/nellemann/hmci/dto/json/VirtualEthernetAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/VirtualEthernetAdapter.java new file mode 100644 index 0000000..c90f9a6 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/VirtualEthernetAdapter.java @@ -0,0 +1,30 @@ +package biz.nellemann.hmci.dto.json; + + +/** + * Network adapter SEA + */ + +public final class VirtualEthernetAdapter { + + public String physicalLocation = ""; + public Integer vlanId = 0; + public Integer vswitchId = 0; + public Boolean isPortVlanId = false; + public Integer viosId = 0; + public String sharedEthernetAdapterId = ""; + + public Double receivedPackets = 0.0; + public Double sentPackets = 0.0; + public Double droppedPackets = 0.0; + public Double sentBytes = 0.0; + public Double receivedBytes = 0.0; + public Double receivedPhysicalPackets = 0.0; + public Double sentPhysicalPackets = 0.0; + public Double droppedPhysicalPackets = 0.0; + public Double sentPhysicalBytes = 0.0; + public Double receivedPhysicalBytes = 0.0; + public Double transferredBytes = 0.0; + public Double transferredPhysicalBytes = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/json/VirtualFiberChannelAdapter.java b/src/main/java/biz/nellemann/hmci/dto/json/VirtualFiberChannelAdapter.java new file mode 100644 index 0000000..dca9565 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/json/VirtualFiberChannelAdapter.java @@ -0,0 +1,23 @@ +package biz.nellemann.hmci.dto.json; + + +/** + * Storage adapter - NPIV ? + */ + +public final class VirtualFiberChannelAdapter { + + public String wwpn = ""; + public String wwpn2 = ""; + public String physicalLocation = ""; + public String physicalPortWWPN = ""; + public Integer viosId = 0; + + public Double numOfReads = 0.0; + public Double numOfWrites = 0.0; + public Double readBytes = 0.0; + public Double writeBytes = 0.0; + public Double runningSpeed = 0.0; + public Double transmittedBytes = 0.0; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/toml/Configuration.java b/src/main/java/biz/nellemann/hmci/dto/toml/Configuration.java new file mode 100644 index 0000000..787c4fa --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/toml/Configuration.java @@ -0,0 +1,12 @@ +package biz.nellemann.hmci.dto.toml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Configuration { + + public InfluxConfiguration influx; + public Map hmc; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/toml/HmcConfiguration.java b/src/main/java/biz/nellemann/hmci/dto/toml/HmcConfiguration.java new file mode 100644 index 0000000..e64d2de --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/toml/HmcConfiguration.java @@ -0,0 +1,28 @@ +package biz.nellemann.hmci.dto.toml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.util.ArrayList; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class HmcConfiguration { + + public String url; + public String name; + public String username; + public String password; + + public Integer refresh = 30; + public Integer discover = 120; + + public String trace; + public Boolean energy = true; + public Boolean trust = true; + + public List excludeSystems = new ArrayList<>(); + public List includeSystems = new ArrayList<>(); + public List excludePartitions = new ArrayList<>(); + public List includePartitions = new ArrayList<>(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/toml/InfluxConfiguration.java b/src/main/java/biz/nellemann/hmci/dto/toml/InfluxConfiguration.java new file mode 100644 index 0000000..a07b85e --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/toml/InfluxConfiguration.java @@ -0,0 +1,17 @@ +package biz.nellemann.hmci.dto.toml; + +public class InfluxConfiguration { + + public String url; + public String username; + public String password; + public String database; + + /*public InfluxConfiguration(String url, String username, String password, String database) { + this.url = url; + this.username = username; + this.password = password; + this.database = database; + }*/ + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/IFixDetail.java b/src/main/java/biz/nellemann/hmci/dto/xml/IFixDetail.java new file mode 100644 index 0000000..3e9f36e --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/IFixDetail.java @@ -0,0 +1,16 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +@JsonIgnoreProperties({ "Atom", "ksv", "kxe", "kb", "schemaVersion", "" }) +public class IFixDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty("IFix") + public String iFix; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/Link.java b/src/main/java/biz/nellemann/hmci/dto/xml/Link.java new file mode 100644 index 0000000..190ed81 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/Link.java @@ -0,0 +1,29 @@ +package biz.nellemann.hmci.dto.xml; + + +import java.io.Serializable; + +public class Link implements Serializable { + + private static final long serialVersionUID = 1L; + + public String rel; + + public String getRel() { + return rel; + } + + + public String type; + + public String getType() { + return type; + } + + public String href; + + public String getHref() { + return href; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/LogicalPartitionEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/LogicalPartitionEntry.java new file mode 100644 index 0000000..36b114d --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/LogicalPartitionEntry.java @@ -0,0 +1,52 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/* +@JsonIgnoreProperties({ + "ksv", "kxe", "kb", "schemaVersion", "Metadata", "AllowPerformanceDataCollection", + "AssociatedPartitionProfile", "AvailabilityPriority", "CurrentProcessorCompatibilityMode", "CurrentProfileSync", + "IsBootable", "IsConnectionMonitoringEnabled", "IsOperationInProgress", "IsRedundantErrorPathReportingEnabled", + "IsTimeReferencePartition", "IsVirtualServiceAttentionLEDOn", "IsVirtualTrustedPlatformModuleEnabled", + "KeylockPosition", "LogicalSerialNumber", "OperatingSystemVersion", "PartitionCapabilities", "PartitionID", + "PartitionIOConfiguration", "PartitionMemoryConfiguration", "PartitionProcessorConfiguration", "PartitionProfiles", + "PendingProcessorCompatibilityMode", "ProcessorPool", "ProgressPartitionDataRemaining", "ProgressPartitionDataTotal", + "ProgressState", "ResourceMonitoringControlState", "ResourceMonitoringIPAddress", "AssociatedManagedSystem", + "ClientNetworkAdapters", "HostEthernetAdapterLogicalPorts", "MACAddressPrefix", "IsServicePartition", + "PowerVMManagementCapable", "ReferenceCode", "AssignAllResources", "HardwareAcceleratorQoS", "LastActivatedProfile", + "HasPhysicalIO", "AllowPerformanceDataCollection", "PendingSecureBoot", "CurrentSecureBoot", "BootMode", + "PowerOnWithHypervisor", "Description", "MigrationStorageViosDataStatus", "MigrationStorageViosDataTimestamp", + "RemoteRestartCapable", "SimplifiedRemoteRestartCapable", "HasDedicatedProcessorsForMigration", "SuspendCapable", + "MigrationDisable", "MigrationState", "RemoteRestartState", "VirtualFibreChannelClientAdapters", + "VirtualSCSIClientAdapters", "BootListInformation" +}) + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class LogicalPartitionEntry implements Serializable, ResourceEntry { + + private static final long serialVersionUID = 1L; + + @JsonProperty("PartitionName") + public String partitionName; + + @JsonProperty("PartitionState") + public String partitionState; + + @JsonProperty("PartitionType") + public String partitionType; + + @JsonProperty("PartitionUUID") + public String partitionUUID; + + @JsonProperty("OperatingSystemType") + public String operatingSystemType; + + @Override + public String getName() { + return partitionName.trim(); + } +} + diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/LogonResponse.java b/src/main/java/biz/nellemann/hmci/dto/xml/LogonResponse.java new file mode 100644 index 0000000..7043707 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/LogonResponse.java @@ -0,0 +1,21 @@ +package biz.nellemann.hmci.dto.xml; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +@JsonIgnoreProperties({ "schemaVersion", "Metadata" }) +public class LogonResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty("X-API-Session") + private String token; + + public String getToken() { + return token; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/MachineTypeModelAndSerialNumber.java b/src/main/java/biz/nellemann/hmci/dto/xml/MachineTypeModelAndSerialNumber.java new file mode 100644 index 0000000..40490cd --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/MachineTypeModelAndSerialNumber.java @@ -0,0 +1,34 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +@JsonIgnoreProperties({ "kb", "kxe", "schemaVersion", "Metadata" }) +public class MachineTypeModelAndSerialNumber implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty("MachineType") + public String machineType; + + public String getMachineType() { + return machineType; + } + + @JsonProperty("Model") + public String model; + + public String getModel() { + return model; + } + + @JsonProperty("SerialNumber") + public String serialNumber; + + public String getSerialNumber() { + return serialNumber; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/ManagedSystemEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/ManagedSystemEntry.java new file mode 100644 index 0000000..92c722d --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/ManagedSystemEntry.java @@ -0,0 +1,94 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/* +@JsonIgnoreProperties({ + "schemaVersion", "Metadata", "AssociatedIPLConfiguration", "AssociatedSystemCapabilities", + "AssociatedSystemIOConfiguration", "AssociatedSystemMemoryConfiguration", "AssociatedSystemProcessorConfiguration", + "AssociatedSystemSecurity", "DetailedState", "ManufacturingDefaultConfigurationEnabled", "MaximumPartitions", + "MaximumPowerControlPartitions", "MaximumRemoteRestartPartitions", "MaximumSharedProcessorCapablePartitionID", + "MaximumSuspendablePartitions", "MaximumBackingDevicesPerVNIC", "PhysicalSystemAttentionLEDState", + "PrimaryIPAddress", "ServiceProcessorFailoverEnabled", "ServiceProcessorFailoverReason", "ServiceProcessorFailoverState", + "ServiceProcessorVersion", "VirtualSystemAttentionLEDState", "SystemMigrationInformation", "ReferenceCode", + "MergedReferenceCode", "EnergyManagementConfiguration", "IsPowerVMManagementMaster", "IsClassicHMCManagement", + "IsPowerVMManagementWithoutMaster", "IsManagementPartitionPowerVMManagementMaster", "IsHMCPowerVMManagementMaster", + "IsNotPowerVMManagementMaster", "IsPowerVMManagementNormalMaster", "IsPowerVMManagementPersistentMaster", + "IsPowerVMManagementTemporaryMaster", "IsPowerVMManagementPartitionEnabled", "SupportedHardwareAcceleratorTypes", + "CurrentStealableProcUnits", "CurrentStealableMemory", "Description", "SystemLocation", "SystemType", + "ProcessorThrottling", "AssociatedPersistentMemoryConfiguration" +})*/ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ManagedSystemEntry implements Serializable, ResourceEntry { + + private static final long serialVersionUID = 1L; + + @JsonProperty("State") + public String state; + + @JsonProperty("Hostname") + public String hostname; + + //@JsonAlias("ActivatedLevel") + @JsonProperty("ActivatedLevel") + public Integer activatedLevel; + + public Integer getActivatedLevel() { + return activatedLevel; + } + + @JsonAlias("ActivatedServicePackNameAndLevel") + public String activatedServicePackNameAndLevel; + + public String getActivatedServicePackNameAndLevel() { + return activatedServicePackNameAndLevel; + } + + @JsonAlias("SystemName") + public String systemName = ""; + + public String getSystemName() { + return systemName.trim(); + } + + @Override + public String getName() { + return systemName.trim(); + } + + @JsonProperty("SystemTime") + public Long systemTime; + + @JsonProperty("SystemFirmware") + public String systemFirmware; + + @JsonAlias("AssociatedLogicalPartitions") + public List associatedLogicalPartitions; + + public List getAssociatedLogicalPartitions() { + return associatedLogicalPartitions != null ? associatedLogicalPartitions : new ArrayList<>(); + } + + + @JsonAlias("AssociatedVirtualIOServers") + public List associatedVirtualIOServers; + + public List getAssociatedVirtualIOServers() { + return associatedVirtualIOServers != null ? associatedVirtualIOServers : new ArrayList<>(); + } + + + @JsonAlias("MachineTypeModelAndSerialNumber") + public MachineTypeModelAndSerialNumber machineTypeModelAndSerialNumber; + + public MachineTypeModelAndSerialNumber getMachineTypeModelAndSerialNumber() { + return machineTypeModelAndSerialNumber; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/ManagementConsoleEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/ManagementConsoleEntry.java new file mode 100644 index 0000000..e02291d --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/ManagementConsoleEntry.java @@ -0,0 +1,99 @@ +package biz.nellemann.hmci.dto.xml; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/* +@JsonIgnoreProperties({ + "schemaVersion", "Metadata", "NetworkInterfaces", "Driver", "LicenseID", "LicenseFirstYear", "UVMID", + "TemplateObjectModelVersion", "UserObjectModelVersion", "WebObjectModelVersion", "PublicSSHKeyValue", + "MinimumKeyStoreSize", "MinimumKeyStoreSize" +})*/ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ManagementConsoleEntry implements Serializable, ResourceEntry { + + private static final long serialVersionUID = 1L; + + @JsonProperty("MachineTypeModelAndSerialNumber") + private MachineTypeModelAndSerialNumber machineTypeModelAndSerialNumber; + + public MachineTypeModelAndSerialNumber getMachineTypeModelAndSerialNumber() { + return machineTypeModelAndSerialNumber; + } + + + @JsonProperty("ManagedSystems") + protected List associatedManagedSystems; + + public List getAssociatedManagedSystems() { + // TODO: Security - Return new array, so receiver cannot modify ours. + return new ArrayList<>(associatedManagedSystems); + } + + + @JsonProperty("ManagementConsoleName") + public String managementConsoleName; + + @Override + public String getName() { + return managementConsoleName.replace("\n", "").trim(); + } + + + @JsonProperty("VersionInfo") + public VersionInfo versionInfo; + + @JsonProperty("BIOS") + protected String bios; + + @JsonProperty("BaseVersion") + protected String baseVersion; + + public String getBaseVersion() { + return baseVersion; + } + + @JsonProperty("IFixDetails") + public IFixDetails iFixDetails; + + + @JsonIgnoreProperties({ "ksv", "kxe", "kb", "schemaVersion", "Metadata" }) + static class IFixDetails { + @JsonProperty("IFixDetail") + public List iFixDetailList; + } + + @JsonProperty("ProcConfiguration") + public ProcConfiguration procConfiguration; + + @JsonIgnoreProperties({ "ksv", "kxe", "kb", "schemaVersion", "Metadata", "Atom" }) + static class ProcConfiguration { + @JsonProperty("NumberOfProcessors") + public Integer numberOfProcessors; + + @JsonProperty("ModelName") + public String modelName; + + @JsonProperty("Architecture") + public String architecture; + } + + @JsonProperty("MemConfiguration") + public MemConfiguration memConfiguration; + + @JsonIgnoreProperties({ "ksv", "kxe", "kb", "schemaVersion", "Metadata", "Atom" }) + static class MemConfiguration { + + @JsonProperty("TotalMemory") + public Integer totalMemory; + + @JsonProperty("TotalSwapMemory") + public Integer totalSwapMemory; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/ResourceEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/ResourceEntry.java new file mode 100644 index 0000000..f7c3851 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/ResourceEntry.java @@ -0,0 +1,6 @@ +package biz.nellemann.hmci.dto.xml; + +public interface ResourceEntry { + String getName(); + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/VersionInfo.java b/src/main/java/biz/nellemann/hmci/dto/xml/VersionInfo.java new file mode 100644 index 0000000..73d9796 --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/VersionInfo.java @@ -0,0 +1,32 @@ +package biz.nellemann.hmci.dto.xml; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +@JsonIgnoreProperties({ "kxe", "kb", "schemaVersion", "Metadata" }) +public class VersionInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty("BuildLevel") + public String buildLevel; + + @JsonProperty("Maintenance") + protected String maintenance; + + @JsonProperty("Minor") + protected String minor; + + @JsonProperty("Release") + protected String release; + + @JsonProperty("ServicePackName") + public String servicePackName; + + @JsonProperty("Version") + protected String version; + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/VirtualIOServerEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/VirtualIOServerEntry.java new file mode 100644 index 0000000..22b9c6f --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/VirtualIOServerEntry.java @@ -0,0 +1,26 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class VirtualIOServerEntry implements Serializable, ResourceEntry { + + private static final long serialVersionUID = 1L; + + @JsonProperty("PartitionName") + private String partitionName; + + public String getPartitionName() { + return partitionName; + } + + @Override + public String getName() { + return partitionName; + } + +} + diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/XmlEntry.java b/src/main/java/biz/nellemann/hmci/dto/xml/XmlEntry.java new file mode 100644 index 0000000..36c60ed --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/XmlEntry.java @@ -0,0 +1,97 @@ +package biz.nellemann.hmci.dto.xml; + +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +//@JsonIgnoreProperties({ "author", "etag" }) +@JsonIgnoreProperties(ignoreUnknown = true) +public class XmlEntry implements Serializable { + + private static final long serialVersionUID = 1L; + + public String id; // 2c6b6620-e3e3-3294-aaf5-38e546ff672b + public String title; // ManagementConsole + public String published; // 2021-11-09T21:13:40.467+01:00 + + public Category category; + + @JsonIgnoreProperties(ignoreUnknown = true) + public class Category { + public String term; + } + + @JsonProperty("link") + public Link link; + + //public List links; + /*public List getLinks() { + return links; + } + */ + + public Content content; + + public Content getContent() { + return content; + } + + public boolean hasContent() { + return content != null; + } + + @JsonIgnoreProperties({ "type" }) + public static class Content { + + @JsonProperty("ManagementConsole") + private ManagementConsoleEntry managementConsoleEntry; + + public ManagementConsoleEntry getManagementConsole() { + return managementConsoleEntry; + } + + public boolean isManagementConsole() { + return managementConsoleEntry != null; + } + + @JsonProperty("ManagedSystem") + private ManagedSystemEntry managedSystemEntry; + + public ManagedSystemEntry getManagedSystemEntry() { + return managedSystemEntry; + } + + public boolean isManagedSystem() { + return managedSystemEntry != null; + } + + + @JsonAlias("VirtualIOServer") + private VirtualIOServerEntry virtualIOServerEntry; + + public VirtualIOServerEntry getVirtualIOServerEntry() { + return virtualIOServerEntry; + } + + public boolean isVirtualIOServer() { + return virtualIOServerEntry != null; + } + + + @JsonAlias("LogicalPartition") + private LogicalPartitionEntry logicalPartitionEntry; + + public LogicalPartitionEntry getLogicalPartitionEntry() { + return logicalPartitionEntry; + } + + public boolean isLogicalPartition() { + return logicalPartitionEntry != null; + } + + } + +} diff --git a/src/main/java/biz/nellemann/hmci/dto/xml/XmlFeed.java b/src/main/java/biz/nellemann/hmci/dto/xml/XmlFeed.java new file mode 100644 index 0000000..258baec --- /dev/null +++ b/src/main/java/biz/nellemann/hmci/dto/xml/XmlFeed.java @@ -0,0 +1,35 @@ +package biz.nellemann.hmci.dto.xml; + + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +//@JsonIgnoreProperties({ "link" }) +@JsonIgnoreProperties(ignoreUnknown = true) +public class XmlFeed implements Serializable { + + private static final long serialVersionUID = 1L; + + public String id; // 347ecfcf-acac-3724-8915-a3d7d7a6f298 + public String updated; // 2021-11-09T21:13:39.591+01:00 + public String generator; // IBM Power Systems Management Console + + @JsonProperty("link") + @JacksonXmlElementWrapper(useWrapping = false) + public List links; // + + @JsonProperty("entry") + @JacksonXmlElementWrapper(useWrapping = false) + public List entries; + + public XmlEntry getEntry() { + return entries.size() > 0 ? entries.get(0) : null; + } + +} diff --git a/src/main/java/biz/nellemann/hmci/pcm/EnergyUtil.java b/src/main/java/biz/nellemann/hmci/pcm/EnergyUtil.java deleted file mode 100644 index a17bfed..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/EnergyUtil.java +++ /dev/null @@ -1,6 +0,0 @@ -package biz.nellemann.hmci.pcm; - -public final class EnergyUtil { - public final PowerUtil powerUtil = new PowerUtil(); - public final ThermalUtil thermalUtil = new ThermalUtil(); -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/FiberChannelAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/FiberChannelAdapter.java deleted file mode 100644 index ddb13bb..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/FiberChannelAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class FiberChannelAdapter { - - public String id = ""; - public String wwpn = ""; - public String physicalLocation = ""; - public Integer numOfPorts = 0; - - @FirstElement - public Number numOfReads = 0.0; - - @FirstElement - public Number numOfWrites = 0.0; - - @FirstElement - public Number readBytes = 0.0; - - @FirstElement - public Number writeBytes = 0.0; - - @FirstElement - public Number runningSpeed = 0.0; - - @FirstElement - public Number transmittedBytes = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/GenericAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/GenericAdapter.java deleted file mode 100644 index c9bb58b..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/GenericAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class GenericAdapter { - - public String id = ""; - public String type = ""; - public String physicalLocation = ""; - - @FirstElement - public Number receivedPackets = 0.0; - - @FirstElement - public Number sentPackets = 0.0; - - @FirstElement - public Number droppedPackets = 0.0; - - @FirstElement - public Number sentBytes = 0.0; - - @FirstElement - public Number receivedBytes = 0.0; - - @FirstElement - public Number transferredBytes = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/GenericPhysicalAdapters.java b/src/main/java/biz/nellemann/hmci/pcm/GenericPhysicalAdapters.java deleted file mode 100644 index 3c92347..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/GenericPhysicalAdapters.java +++ /dev/null @@ -1,26 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class GenericPhysicalAdapters { - - public String id = ""; - public String type = ""; - public String physicalLocation = ""; - - @FirstElement - public Number numOfReads = 0.0; - - @FirstElement - public Number numOfWrites = 0.0; - - @FirstElement - public Number readBytes = 0.0; - - @FirstElement - public Number writeBytes = 0.0; - - @FirstElement - public Number transmittedBytes = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/GenericVirtualAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/GenericVirtualAdapter.java deleted file mode 100644 index bdf218f..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/GenericVirtualAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - - -public final class GenericVirtualAdapter { - - public String id = ""; - public String type = ""; - public Integer viosId = 0; - public String physicalLocation = ""; - - @FirstElement - public Number numOfReads = 0.0; - - @FirstElement - public Number numOfWrites = 0.0; - - @FirstElement - public Number readBytes = 0.0; - - @FirstElement - public Number writeBytes = 0.0; - - @FirstElement - public Number transmittedBytes = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/LparMemory.java b/src/main/java/biz/nellemann/hmci/pcm/LparMemory.java deleted file mode 100644 index 2c2aa25..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/LparMemory.java +++ /dev/null @@ -1,16 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class LparMemory { - - @FirstElement - public Number logicalMem = 0.0; - - @FirstElement - public Number utilizedMem = 0.0; - - @FirstElement - public Number backedPhysicalMem = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/LparProcessor.java b/src/main/java/biz/nellemann/hmci/pcm/LparProcessor.java deleted file mode 100644 index bd3bf36..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/LparProcessor.java +++ /dev/null @@ -1,44 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class LparProcessor { - - public Integer poolId = 0; - public Integer weight = 0; - public String mode = ""; - - @FirstElement - public Number maxVirtualProcessors = 0.0; - - @FirstElement - public Number currentVirtualProcessors = 0.0; - - @FirstElement - public Number maxProcUnits = 0.0; - - @FirstElement - public Number entitledProcUnits = 0.0; - - @FirstElement - public Number utilizedProcUnits = 0.0; - - @FirstElement - public Number utilizedCappedProcUnits = 0.0; - - @FirstElement - public Number utilizedUncappedProcUnits = 0.0; - - @FirstElement - public Number idleProcUnits = 0.0; - - @FirstElement - public Number donatedProcUnits = 0.0; - - @FirstElement - public Number timeSpentWaitingForDispatch = 0.0; - - @FirstElement - public Number timePerInstructionExecution = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/Network.java b/src/main/java/biz/nellemann/hmci/pcm/Network.java deleted file mode 100644 index 2860cb1..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/Network.java +++ /dev/null @@ -1,15 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import java.util.ArrayList; -import java.util.List; - -public final class Network { - - public final List clientLpars = new ArrayList<>(); - public final List genericAdapters = new ArrayList<>(); - public final List sharedAdapters = new ArrayList<>(); - public final List virtualEthernetAdapters = new ArrayList<>(); - - public final List sriovLogicalPorts = new ArrayList<>(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/PcmData.java b/src/main/java/biz/nellemann/hmci/pcm/PcmData.java deleted file mode 100644 index ee634d4..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/PcmData.java +++ /dev/null @@ -1,7 +0,0 @@ -package biz.nellemann.hmci.pcm; - -public final class PcmData { - - public final SystemUtil systemUtil = new SystemUtil(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/PhysicalProcessorPool.java b/src/main/java/biz/nellemann/hmci/pcm/PhysicalProcessorPool.java deleted file mode 100644 index 8ffe855..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/PhysicalProcessorPool.java +++ /dev/null @@ -1,22 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class PhysicalProcessorPool { - - @FirstElement - public Number assignedProcUnits = 0.0; - - @FirstElement - public Number utilizedProcUnits = 0.0; - - @FirstElement - public Number availableProcUnits = 0.0; - - @FirstElement - public Number configuredProcUnits = 0.0; - - @FirstElement - public Number borrowedProcUnits = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/PowerUtil.java b/src/main/java/biz/nellemann/hmci/pcm/PowerUtil.java deleted file mode 100644 index 741485e..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/PowerUtil.java +++ /dev/null @@ -1,11 +0,0 @@ - -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class PowerUtil { - - @FirstElement - public Number powerReading = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SampleInfo.java b/src/main/java/biz/nellemann/hmci/pcm/SampleInfo.java deleted file mode 100644 index 5dfc631..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/SampleInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package biz.nellemann.hmci.pcm; - -public final class SampleInfo { - - public String timeStamp = ""; - public Integer status = 0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ServerMemory.java b/src/main/java/biz/nellemann/hmci/pcm/ServerMemory.java deleted file mode 100644 index 5aa3324..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/ServerMemory.java +++ /dev/null @@ -1,22 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class ServerMemory { - - @FirstElement - public Number totalMem = 0.0; - - @FirstElement - public Number availableMem = 0.0; - - @FirstElement - public Number configurableMem = 0.0; - - @FirstElement - public Number assignedMemToLpars = 0.0; - - @FirstElement - public Number virtualPersistentMem = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ServerProcessor.java b/src/main/java/biz/nellemann/hmci/pcm/ServerProcessor.java deleted file mode 100644 index 387a971..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/ServerProcessor.java +++ /dev/null @@ -1,19 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class ServerProcessor { - - @FirstElement - public Number totalProcUnits = 0.0; - - @FirstElement - public Number utilizedProcUnits = 0.0; - - @FirstElement - public Number availableProcUnits = 0.0; - - @FirstElement - public Number configurableProcUnits = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ServerUtil.java b/src/main/java/biz/nellemann/hmci/pcm/ServerUtil.java deleted file mode 100644 index d5fab0d..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/ServerUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import java.util.ArrayList; -import java.util.List; - -public final class ServerUtil { - - public final ServerProcessor processor = new ServerProcessor(); - public final ServerMemory memory = new ServerMemory(); - public final PhysicalProcessorPool physicalProcessorPool = new PhysicalProcessorPool(); - public final List sharedProcessorPool = new ArrayList<>(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SharedAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/SharedAdapter.java deleted file mode 100644 index d9ac58e..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/SharedAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class SharedAdapter { - - public String id = ""; - public String type = ""; - public String physicalLocation = ""; - - @FirstElement - public Number receivedPackets = 0.0; - - @FirstElement - public Number sentPackets = 0.0; - - @FirstElement - public Number droppedPackets = 0.0; - - @FirstElement - public Number sentBytes = 0.0; - - @FirstElement - public Number receivedBytes = 0.0; - - @FirstElement - public Number transferredBytes = 0.0; - - @FirstElement - public String bridgedAdapters = ""; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SharedProcessorPool.java b/src/main/java/biz/nellemann/hmci/pcm/SharedProcessorPool.java deleted file mode 100644 index aaddbf0..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/SharedProcessorPool.java +++ /dev/null @@ -1,25 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class SharedProcessorPool { - - public String id = ""; - public String name = ""; - - @FirstElement - public Number assignedProcUnits = 0.0; - - @FirstElement - public Number utilizedProcUnits = 0.0; - - @FirstElement - public Number availableProcUnits = 0.0; - - @FirstElement - public Number configuredProcUnits = 0.0; - - @FirstElement - public Number borrowedProcUnits = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/Storage.java b/src/main/java/biz/nellemann/hmci/pcm/Storage.java deleted file mode 100644 index 7b31588..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/Storage.java +++ /dev/null @@ -1,14 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import java.util.ArrayList; -import java.util.List; - -public final class Storage { - - public final List clientLpars = new ArrayList<>(); - public final List genericPhysicalAdapters = new ArrayList<>(); - public final List genericVirtualAdapters = new ArrayList<>(); - public final List fiberChannelAdapters = new ArrayList<>(); - public final List virtualFiberChannelAdapters = new ArrayList<>(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SystemFirmware.java b/src/main/java/biz/nellemann/hmci/pcm/SystemFirmware.java deleted file mode 100644 index aadc923..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/SystemFirmware.java +++ /dev/null @@ -1,13 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class SystemFirmware { - - @FirstElement - public Number utilizedProcUnits = 0.0; - - @FirstElement - public Number assignedMem = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/SystemUtil.java b/src/main/java/biz/nellemann/hmci/pcm/SystemUtil.java deleted file mode 100644 index cebb612..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/SystemUtil.java +++ /dev/null @@ -1,14 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; -import com.squareup.moshi.Json; - -public final class SystemUtil { - - public UtilInfo utilInfo; - - @FirstElement - @Json(name = "utilSamples") - public UtilSample sample; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ThermalUtil.java b/src/main/java/biz/nellemann/hmci/pcm/ThermalUtil.java deleted file mode 100644 index 08cfbfd..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/ThermalUtil.java +++ /dev/null @@ -1,12 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import java.util.ArrayList; -import java.util.List; - -public final class ThermalUtil { - - public final List inletTemperatures = new ArrayList<>(); - public final List cpuTemperatures = new ArrayList<>(); - public final List baseboardTemperatures = new ArrayList<>(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/UtilSample.java b/src/main/java/biz/nellemann/hmci/pcm/UtilSample.java deleted file mode 100644 index c0a1da5..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/UtilSample.java +++ /dev/null @@ -1,20 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -import java.util.ArrayList; -import java.util.List; - -public final class UtilSample { - - public String sampleType = ""; - public final SampleInfo sampleInfo = new SampleInfo(); - public final SystemFirmware systemFirmwareUtil = new SystemFirmware(); - public final ServerUtil serverUtil = new ServerUtil(); - public final EnergyUtil energyUtil = new EnergyUtil(); - public final List viosUtil = new ArrayList<>(); - - @FirstElement - public final LparUtil lparsUtil = new LparUtil(); - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/ViosMemory.java b/src/main/java/biz/nellemann/hmci/pcm/ViosMemory.java deleted file mode 100644 index cb8af1a..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/ViosMemory.java +++ /dev/null @@ -1,13 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class ViosMemory { - - @FirstElement - public Number assignedMem = 0.0; - - @FirstElement - public Number utilizedMem = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/VirtualEthernetAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/VirtualEthernetAdapter.java deleted file mode 100644 index afd4a89..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/VirtualEthernetAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - - -public final class VirtualEthernetAdapter { - - public String physicalLocation = ""; - public Integer vlanId = 0; - public Integer vswitchId = 0; - public Boolean isPortVlanId = false; - public Integer viosId = 0; - public String sharedEthernetAdapterId = ""; - - @FirstElement - public Number receivedPackets = 0.0; - - @FirstElement - public Number sentPackets = 0.0; - - @FirstElement - public Number droppedPackets = 0.0; - - @FirstElement - public Number sentBytes = 0.0; - - @FirstElement - public Number receivedBytes = 0.0; - - @FirstElement - public Number receivedPhysicalPackets = 0.0; - - @FirstElement - public Number sentPhysicalPackets = 0.0; - - @FirstElement - public Number droppedPhysicalPackets = 0.0; - - @FirstElement - public Number sentPhysicalBytes = 0.0; - - @FirstElement - public Number receivedPhysicalBytes = 0.0; - - @FirstElement - public Number transferredBytes = 0.0; - - @FirstElement - public Number transferredPhysicalBytes = 0.0; - -} diff --git a/src/main/java/biz/nellemann/hmci/pcm/VirtualFiberChannelAdapter.java b/src/main/java/biz/nellemann/hmci/pcm/VirtualFiberChannelAdapter.java deleted file mode 100644 index 41dd33d..0000000 --- a/src/main/java/biz/nellemann/hmci/pcm/VirtualFiberChannelAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -package biz.nellemann.hmci.pcm; - -import com.serjltt.moshi.adapters.FirstElement; - -public final class VirtualFiberChannelAdapter { - - public String wwpn = ""; - public String wwpn2 = ""; - public String physicalLocation = ""; - public String physicalPortWWPN = ""; - public Integer viosId = 0; - - @FirstElement - public Number numOfReads = 0.0; - - @FirstElement - public Number numOfWrites = 0.0; - - @FirstElement - public Number readBytes = 0.0; - - @FirstElement - public Number writeBytes = 0.0; - - @FirstElement - public Number runningSpeed = 0.0; - - @FirstElement - public Number transmittedBytes = 0.0; - -} diff --git a/src/test/groovy/biz/nellemann/hmci/ConfigurationTest.groovy b/src/test/groovy/biz/nellemann/hmci/ConfigurationTest.groovy index 6c40bf0..6bbb394 100644 --- a/src/test/groovy/biz/nellemann/hmci/ConfigurationTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/ConfigurationTest.groovy @@ -1,5 +1,8 @@ package biz.nellemann.hmci +import biz.nellemann.hmci.dto.toml.Configuration +import biz.nellemann.hmci.dto.toml.HmcConfiguration +import com.fasterxml.jackson.dataformat.toml.TomlMapper import spock.lang.Specification import java.nio.file.Path @@ -10,36 +13,52 @@ class ConfigurationTest extends Specification { Path testConfigurationFile = Paths.get(getClass().getResource('/hmci.toml').toURI()) + TomlMapper mapper + + def setup() { + mapper = new TomlMapper(); + } + + def cleanup() { + } + + void "test parsing of configuration file"() { when: - Configuration conf = new Configuration(testConfigurationFile) + Configuration conf = mapper.readerFor(Configuration.class).readValue(testConfigurationFile.toFile()) + + println(conf.hmc.entrySet().forEach((e) -> { + println((String)e.key + " -> " + e); + + HmcConfiguration c = e.value; + println(c.url); + })); then: conf != null + } + + void "test HMC energy flag, default setting"() { + + when: + Configuration conf = mapper.readerFor(Configuration.class).readValue(testConfigurationFile.toFile()) + + then: + !conf.hmc.get("site1").energy } - void "test energy flag, default setting"() { + void "test HMC exclude and include options"() { when: - Configuration conf = new Configuration(testConfigurationFile) + Configuration conf = mapper.readerFor(Configuration.class).readValue(testConfigurationFile.toFile()) then: - !conf.getHmc().get(0).energy - - } - - void "test exclude and include options"() { - - when: - Configuration conf = new Configuration(testConfigurationFile) - - then: - conf.getHmc().get(0).excludeSystems.contains("notThisSys") - conf.getHmc().get(0).includeSystems.contains("onlyThisSys") - conf.getHmc().get(0).excludePartitions.contains("notThisPartition") - conf.getHmc().get(0).includePartitions.contains("onlyThisPartition") + conf.hmc.get("site1").excludeSystems.contains("notThisSys") + conf.hmc.get("site1").includeSystems.contains("onlyThisSys") + conf.hmc.get("site1").excludePartitions.contains("notThisPartition") + conf.hmc.get("site1").includePartitions.contains("onlyThisPartition") } diff --git a/src/test/groovy/biz/nellemann/hmci/HmcRestClientTest.groovy b/src/test/groovy/biz/nellemann/hmci/HmcRestClientTest.groovy deleted file mode 100644 index 5b4c4f4..0000000 --- a/src/test/groovy/biz/nellemann/hmci/HmcRestClientTest.groovy +++ /dev/null @@ -1,102 +0,0 @@ -package biz.nellemann.hmci - -import okhttp3.mockwebserver.MockResponse -import okhttp3.mockwebserver.MockWebServer -import spock.lang.Specification - -class HmcRestClientTest extends Specification { - - HmcRestClient hmc - MockWebServer mockServer = new MockWebServer() - - - def setup() { - mockServer.start() - hmc = new HmcRestClient(mockServer.url("/").toString(), "testUser", "testPassword", true) - hmc.authToken = "blaBla" - } - - - def cleanup() { - mockServer.shutdown() - } - - void "test against empty xml"() { - setup: - def testXml = "" - mockServer.enqueue(new MockResponse().setBody(testXml)) - - when: - Map systems = hmc.getManagedSystems() - - then: - systems.size() == 0 - } - - - void "test getManagedSystems"() { - setup: - def testFile = new File(getClass().getResource('/managed-systems.xml').toURI()) - def testXml = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testXml)) - - when: - Map systems = hmc.getManagedSystems() - - then: - systems.size() == 2 - systems.get("e09834d1-c930-3883-bdad-405d8e26e166").name == "S822L-8247-213C1BA" - } - - - void "test getLogicalPartitionsForManagedSystem"() { - setup: - def testFile = new File(getClass().getResource('/logical-partitions.xml').toURI()) - def testXml = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testXml)) - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - Map partitions = hmc.getLogicalPartitionsForManagedSystem(system) - - then: - partitions.size() == 12 - partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").name == "AIX_Test1-e0f725f0-00000005" - partitions.get("3380A831-9D22-4F03-A1DF-18B249F0FF8E").type == "AIX/Linux" - } - - - void "test getBody with JSON for ManagedSystem"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testJson)) - - when: - String jsonString = hmc.sendGetRequest(new URL(mockServer.url("/rest/api/pcm/ProcessedMetrics/ManagedSystem_e09834d1-c930-3883-bdad-405d8e26e166_20200807T122600+0200_20200807T122600+0200_30.json") as String)) - - then: - jsonString.contains('"uuid": "e09834d1-c930-3883-bdad-405d8e26e166"') - } - - - void "test getBody with JSON for LogicalPartition"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - mockServer.enqueue(new MockResponse().setBody(testJson)) - - when: - String jsonString = hmc.sendGetRequest(new URL(mockServer.url("/rest/api/pcm/ProcessedMetrics/LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82_20200807T123730+0200_20200807T123730+0200_30.json") as String)) - - then: - jsonString.contains('"uuid": "b597e4da-2aab-3f52-8616-341d62153559"') - } - - - // getPcmDataForManagedSystem - - // getPcmDataForLogicalPartition - - -} diff --git a/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy b/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy index 3f97f01..8f4ae4f 100644 --- a/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/InfluxClientTest.groovy @@ -1,5 +1,6 @@ package biz.nellemann.hmci +import biz.nellemann.hmci.dto.toml.InfluxConfiguration import spock.lang.Ignore import spock.lang.Specification @@ -9,7 +10,7 @@ class InfluxClientTest extends Specification { InfluxClient influxClient def setup() { - influxClient = new InfluxClient(new Configuration.InfluxObject("http://localhost:8086", "root", "", "hmci")) + influxClient = new InfluxClient(new InfluxConfiguration("http://localhost:8086", "root", "", "hmci")) influxClient.login() } diff --git a/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy index cd47fda..5bedd67 100644 --- a/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/LogicalPartitionTest.groovy @@ -1,101 +1,145 @@ package biz.nellemann.hmci +import biz.nellemann.hmci.dto.xml.LogicalPartitionEntry +import org.mockserver.integration.ClientAndServer +import org.mockserver.logging.MockServerLogger +import org.mockserver.socket.PortFactory +import org.mockserver.socket.tls.KeyStoreFactory +import spock.lang.Shared import spock.lang.Specification + +import javax.net.ssl.HttpsURLConnection + class LogicalPartitionTest extends Specification { + @Shared + private static ClientAndServer mockServer; - void "test processPcmJson for LogicalPartition"() { + @Shared + private RestClient serviceClient - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') + @Shared + private ManagedSystem managedSystem - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - lpar.processMetrics(testJson) + @Shared + private LogicalPartition logicalPartition - then: - lpar.metrics.systemUtil.sample.lparsUtil.memory.logicalMem == 8192.000 - lpar.metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits == 0.001 - lpar.metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.first().receivedBytes == 276.467 + @Shared + private File metricsFile + + def setupSpec() { + HttpsURLConnection.setDefaultSSLSocketFactory(new KeyStoreFactory(new MockServerLogger()).sslContext().getSocketFactory()); + mockServer = ClientAndServer.startClientAndServer(PortFactory.findFreePort()); + serviceClient = new RestClient(String.format("http://localhost:%d", mockServer.getPort()), "user", "password", false) + MockResponses.prepareClientResponseForLogin(mockServer) + MockResponses.prepareClientResponseForManagedSystem(mockServer) + MockResponses.prepareClientResponseForVirtualIOServer(mockServer) + MockResponses.prepareClientResponseForLogicalPartition(mockServer) + serviceClient.login() + + managedSystem = new ManagedSystem(serviceClient, String.format("%s/rest/api/uom/ManagementConsole/2c6b6620-e3e3-3294-aaf5-38e546ff672b/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559", serviceClient.baseUrl)); + managedSystem.discover() + + logicalPartition = managedSystem.logicalPartitions.first() + logicalPartition.refresh() + + metricsFile = new File("src/test/resources/3-logical-partition-perf-data.json") } + def cleanupSpec() { + mockServer.stop() + } + + def setup() { + } + + + def "check that we found 2 logical partitions"() { + expect: + managedSystem.logicalPartitions.size() == 18 + } + + + def "check name of 1st virtual server"() { + when: + LogicalPartitionEntry entry = logicalPartition.entry + + then: + entry.getName() == "rhel8-ocp-helper" + } + + + void "process metrics data"() { + when: + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + + then: + logicalPartition.metric != null + } + + + void "test basic metrics"() { + when: + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + + then: + logicalPartition.metric.getSample().lparsUtil.memory.logicalMem == 8192.000 + logicalPartition.metric.getSample().lparsUtil.processor.utilizedProcUnits == 0.001 + logicalPartition.metric.getSample().lparsUtil.network.virtualEthernetAdapters.first().receivedBytes == 276.467 + } void "test getDetails"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getDetails() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getDetails() then: listOfMeasurements.size() == 1 listOfMeasurements.first().fields['affinityScore'] == 100.0 listOfMeasurements.first().fields['osType'] == 'Linux' listOfMeasurements.first().fields['type'] == 'AIX/Linux' - listOfMeasurements.first().tags['lparname'] == '9Flash01' + listOfMeasurements.first().tags['lparname'] == 'rhel8-ocp-helper' } void "test getMemoryMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getMemoryMetrics() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getMemoryMetrics() then: listOfMeasurements.size() == 1 listOfMeasurements.first().fields['logicalMem'] == 8192.000 - listOfMeasurements.first().tags['lparname'] == '9Flash01' + listOfMeasurements.first().tags['lparname'] == 'rhel8-ocp-helper' } + void "test getProcessorMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getProcessorMetrics() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getProcessorMetrics() then: listOfMeasurements.size() == 1 listOfMeasurements.first().fields['utilizedProcUnits'] == 0.001 - listOfMeasurements.first().tags['lparname'] == '9Flash01' + listOfMeasurements.first().tags['lparname'] == 'rhel8-ocp-helper' } + void "test getVirtualEthernetAdapterMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getVirtualEthernetAdapterMetrics() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getVirtualEthernetAdapterMetrics() then: listOfMeasurements.size() == 1 @@ -103,17 +147,12 @@ class LogicalPartitionTest extends Specification { listOfMeasurements.first().tags['location'] == 'U9009.42A.21F64EV-V13-C32' } + void "test getVirtualFiberChannelAdaptersMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getVirtualFibreChannelAdapterMetrics() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getVirtualFibreChannelAdapterMetrics() then: listOfMeasurements.size() == 4 @@ -122,48 +161,16 @@ class LogicalPartitionTest extends Specification { } + void "test getVirtualGenericAdapterMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getVirtualGenericAdapterMetrics() + logicalPartition.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = logicalPartition.getVirtualGenericAdapterMetrics() then: listOfMeasurements.size() == 1 listOfMeasurements.first().fields['readBytes'] == 0.0 } - void "test getSriovLogicalPortMetrics'"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-logical-partition-sriov.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system) - - when: - lpar.processMetrics(testJson) - List listOfMeasurements = lpar.getSriovLogicalPorts() - - then: - listOfMeasurements.size() == 6 - listOfMeasurements.first().tags['location'] == "U78CA.001.CSS0CXA-P1-C2-C1-T1-S2" - listOfMeasurements.first().tags['vnicDeviceMode'] == "NonVNIC" - listOfMeasurements.first().tags['configurationType'] == "Ethernet" - listOfMeasurements.first().fields['drcIndex'] == "654327810" - listOfMeasurements.first().fields['physicalPortId'] == 0 - listOfMeasurements.first().fields['physicalDrcIndex'] == "553713681" - listOfMeasurements.first().fields['receivedPackets'] == 16.867 - listOfMeasurements.first().fields['sentPackets'] == 0.067 - listOfMeasurements.first().fields['sentBytes'] == 8.533 - listOfMeasurements.first().fields['receivedBytes'] == 1032.933 - listOfMeasurements.first().fields['transferredBytes'] == 1041.466 - } - } diff --git a/src/test/groovy/biz/nellemann/hmci/ManagedSystemEntryTest.groovy b/src/test/groovy/biz/nellemann/hmci/ManagedSystemEntryTest.groovy new file mode 100644 index 0000000..c3b1924 --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/ManagedSystemEntryTest.groovy @@ -0,0 +1,28 @@ +package biz.nellemann.hmci + +import biz.nellemann.hmci.dto.xml.ManagedSystemEntry +import biz.nellemann.hmci.dto.xml.XmlEntry +import com.fasterxml.jackson.dataformat.xml.XmlMapper +import spock.lang.Specification + +class ManagedSystemEntryTest extends Specification { + + + void "parsing hmc xml managed system"() { + + setup: + def testFile = new File(getClass().getResource('/2-managed-system.xml').toURI()) + XmlMapper xmlMapper = new XmlMapper(); + + when: + XmlEntry entry = xmlMapper.readValue(testFile, XmlEntry.class); + ManagedSystemEntry managedSystem = entry.getContent().getManagedSystemEntry() + + then: + managedSystem != null + managedSystem.activatedLevel == 145 + managedSystem.activatedServicePackNameAndLevel == "FW930.50 (145)" + + } +} + diff --git a/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy index d4aa7f0..0f9c473 100644 --- a/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy +++ b/src/test/groovy/biz/nellemann/hmci/ManagedSystemTest.groovy @@ -1,57 +1,74 @@ package biz.nellemann.hmci +import org.mockserver.integration.ClientAndServer +import org.mockserver.logging.MockServerLogger +import org.mockserver.socket.PortFactory +import org.mockserver.socket.tls.KeyStoreFactory +import spock.lang.Shared import spock.lang.Specification +import javax.net.ssl.HttpsURLConnection + class ManagedSystemTest extends Specification { - void "test processPcmJson for ManagedSystem"() { + @Shared + private static ClientAndServer mockServer; - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') + @Shared + private RestClient serviceClient - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - system.processMetrics(testJson) + @Shared + private ManagedSystem managedSystem - then: - system.metrics.systemUtil.sample.serverUtil.memory.assignedMemToLpars == 40960.000 - system.metrics.systemUtil.sample.serverUtil.processor.totalProcUnits == 24.000 - system.metrics.systemUtil.sample.viosUtil.first().name == "VIOS1" - system.metrics.systemUtil.sample.viosUtil.first().memory.assignedMem == 8192.0 - system.metrics.systemUtil.sample.viosUtil.first().storage.genericPhysicalAdapters.first().transmittedBytes == 9966.933 - system.metrics.systemUtil.sample.viosUtil.first().storage.fiberChannelAdapters.first().numOfPorts == 3 + @Shared + private File metricsFile + def setupSpec() { + HttpsURLConnection.setDefaultSSLSocketFactory(new KeyStoreFactory(new MockServerLogger()).sslContext().getSocketFactory()); + mockServer = ClientAndServer.startClientAndServer(PortFactory.findFreePort()); + serviceClient = new RestClient(String.format("http://localhost:%d", mockServer.getPort()), "user", "password", false) + MockResponses.prepareClientResponseForLogin(mockServer) + MockResponses.prepareClientResponseForManagementConsole(mockServer) + MockResponses.prepareClientResponseForManagedSystem(mockServer) + MockResponses.prepareClientResponseForVirtualIOServer(mockServer) + MockResponses.prepareClientResponseForLogicalPartition(mockServer) + serviceClient.login() + managedSystem = new ManagedSystem(serviceClient, String.format("%s/rest/api/uom/ManagementConsole/2c6b6620-e3e3-3294-aaf5-38e546ff672b/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559", serviceClient.baseUrl)); + managedSystem.discover() + metricsFile = new File(getClass().getResource('/2-managed-system-perf-data2.json').toURI()) + } + + def cleanupSpec() { + mockServer.stop() + } + + def setup() { + } + + def "test we got entry"() { + + expect: + managedSystem.entry.getName() == "Server-9009-42A-SN21F64EV" } void "test getDetails"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getDetails() + managedSystem.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = managedSystem.getDetails() then: listOfMeasurements.size() == 1 - listOfMeasurements.first().tags['servername'] == 'Test Name' - listOfMeasurements.first().fields['utilizedProcUnits'] == 0.0 - listOfMeasurements.first().fields['assignedMem'] == 5632.0 + listOfMeasurements.first().tags['servername'] == 'Server-9009-42A-SN21F64EV' + listOfMeasurements.first().fields['utilizedProcUnits'] == 0.00458 + listOfMeasurements.first().fields['assignedMem'] == 40448.0 } void "test getMemoryMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getMemoryMetrics() + managedSystem.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = managedSystem.getMemoryMetrics() then: listOfMeasurements.size() == 1 @@ -60,240 +77,37 @@ class ManagedSystemTest extends Specification { void "test getProcessorMetrics"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getProcessorMetrics() + managedSystem.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = managedSystem.getProcessorMetrics() then: listOfMeasurements.size() == 1 - listOfMeasurements.first().fields['availableProcUnits'] == 16.000 + listOfMeasurements.first().fields['availableProcUnits'] == 4.65 } void "test getSystemSharedProcessorPools"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getSharedProcessorPools() - - then: - listOfMeasurements.size() == 1 - listOfMeasurements.first().fields['assignedProcUnits'] == 23.767 - } - - void "test VIOS data"() { - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getSharedProcessorPools() - - then: - listOfMeasurements.size() == 1 - listOfMeasurements.first().fields['assignedProcUnits'] == 23.767 - } - - void "test getViosMemoryMetrics"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosMemoryMetrics() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().fields['assignedMem'] == 8192.000 - listOfMeasurements.first().fields['utilizedMem'] == 2093.000 - } - - void "test getViosProcessorMetrics"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosProcessorMetrics() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().fields['mode'] == "share_idle_procs_active" - listOfMeasurements.first().fields['entitledProcUnits'] == 1.0 - listOfMeasurements.first().fields['utilizedCappedProcUnits'] == 0.12 - } - - - void "test getViosNetworkLpars"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosNetworkLpars() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().fields['clientlpars'] == 1 - } - - - void "test getViosNetworkSharedAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosNetworkSharedAdapters() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C2-T1" - listOfMeasurements.first().fields['type'] == "sea" - listOfMeasurements.first().fields['transferredBytes'] == 14180.2d - } - - - void "test getViosNetworkVirtualAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosNetworkVirtualAdapters() + managedSystem.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = managedSystem.getSharedProcessorPools() then: listOfMeasurements.size() == 4 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C2" - listOfMeasurements.first().tags['vswitchid'] == "0" - listOfMeasurements.first().fields['transferredBytes'] == 8245.4d + listOfMeasurements.first().fields['assignedProcUnits'] == 22.00013 } - - void "test getViosNetworkGenericAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - + void "test getPhysicalProcessorPool"() { when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosNetworkGenericAdapters() + managedSystem.deserialize(metricsFile.getText('UTF-8')) + List listOfMeasurements = managedSystem.getPhysicalProcessorPool() then: - listOfMeasurements.size() == 6 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C10-T3" - listOfMeasurements.first().fields['receivedBytes'] == 1614.567d - listOfMeasurements.first().fields['sentBytes'] == 3511.833d + listOfMeasurements.size() == 1 + listOfMeasurements.first().fields['assignedProcUnits'] == 22.0 + } - void "test getViosStorageLpars"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosStorageLpars() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().fields['clientlpars'] == 1 - } - - - void "test getViosStorageFiberChannelAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosStorageFiberChannelAdapters() - - then: - listOfMeasurements.size() == 4 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C12-T1" - listOfMeasurements.first().fields['numOfReads'] == 0.0 - listOfMeasurements.first().fields['numOfWrites'] == 0.067d - } - - - void "test getViosStoragePhysicalAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosStoragePhysicalAdapters() - - then: - listOfMeasurements.size() == 2 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U78CB.001.WZS0BYF-P1-C14-T1" - listOfMeasurements.first().fields['numOfReads'] == 0.0 - listOfMeasurements.first().fields['numOfWrites'] == 19.467d - } - - - void "test getViosStorageVirtualAdapters"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - - when: - system.processMetrics(testJson) - List listOfMeasurements = system.getViosStorageVirtualAdapters() - - then: - listOfMeasurements.size() == 3 - listOfMeasurements.first().tags['viosname'] == "VIOS1" - listOfMeasurements.first().tags['location'] == "U8247.22L.213C1BA-V1-C6" - listOfMeasurements.first().fields['numOfReads'] == 0.0 - listOfMeasurements.first().fields['numOfWrites'] == 0.0 - } - } + diff --git a/src/test/groovy/biz/nellemann/hmci/ManagementConsoleEntryTest.groovy b/src/test/groovy/biz/nellemann/hmci/ManagementConsoleEntryTest.groovy new file mode 100644 index 0000000..16441f5 --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/ManagementConsoleEntryTest.groovy @@ -0,0 +1,60 @@ +package biz.nellemann.hmci + +import biz.nellemann.hmci.dto.xml.ManagementConsoleEntry +import biz.nellemann.hmci.dto.xml.XmlEntry +import biz.nellemann.hmci.dto.xml.XmlFeed +import com.fasterxml.jackson.dataformat.xml.XmlMapper +import spock.lang.Specification + + +class ManagementConsoleEntryTest extends Specification { + + void "parsing hmc xml feed and entry"() { + + setup: + def testFile = new File(getClass().getResource('/1-hmc.xml').toURI()) + XmlMapper xmlMapper = new XmlMapper(); + + when: + XmlFeed feed = xmlMapper.readValue(testFile.getText(), XmlFeed.class); + XmlEntry entry = feed.entry; + + then: + feed.id == "347ecfcf-acac-3724-8915-a3d7d7a6f298" + //feed.links.first().rel == "SELF" + //feed.links.first().href == "https://10.32.64.39:12443/rest/api/uom/ManagementConsole" + entry.id == "2c6b6620-e3e3-3294-aaf5-38e546ff672b" + entry.title == "ManagementConsole" + + } + + void "parsing hmc xml management console"() { + + setup: + def testFile = new File(getClass().getResource('/1-hmc.xml').toURI()) + XmlMapper xmlMapper = new XmlMapper(); + + when: + XmlFeed feed = xmlMapper.readValue(testFile.getText(), XmlFeed.class); + ManagementConsoleEntry managementConsole = feed.entry.getContent().getManagementConsole(); + + then: + managementConsole.getMachineTypeModelAndSerialNumber() != null + managementConsole.getMachineTypeModelAndSerialNumber().getMachineType() == "7042" + managementConsole.getMachineTypeModelAndSerialNumber().getModel() == "CR7" + managementConsole.getMachineTypeModelAndSerialNumber().getSerialNumber() == "21D3CBC" + managementConsole.getAssociatedManagedSystems().size() == 1; + managementConsole.getAssociatedManagedSystems().first().href == "https://10.32.64.39:12443/rest/api/uom/ManagementConsole/2c6b6620-e3e3-3294-aaf5-38e546ff672b/ManagedSystem/b597e4da-2aab-3f52-8616-341d62153559" + managementConsole.managementConsoleName == 'HMC-P9\n ' + managementConsole.versionInfo.buildLevel == '2011270432' + managementConsole.versionInfo.servicePackName == '942' + managementConsole.iFixDetails.iFixDetailList.size() == 2 + managementConsole.procConfiguration.numberOfProcessors == 6 + managementConsole.procConfiguration.modelName == "Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz" + managementConsole.procConfiguration.architecture == "x86_64" + managementConsole.memConfiguration.totalMemory == 7957 + managementConsole.memConfiguration.totalSwapMemory == 2046 + + } + +} diff --git a/src/test/groovy/biz/nellemann/hmci/MetaSystemTest.groovy b/src/test/groovy/biz/nellemann/hmci/MetaSystemTest.groovy deleted file mode 100644 index c914777..0000000 --- a/src/test/groovy/biz/nellemann/hmci/MetaSystemTest.groovy +++ /dev/null @@ -1,24 +0,0 @@ -package biz.nellemann.hmci - -import spock.lang.Specification - -import java.time.Instant - -class MetaSystemTest extends Specification { - - void "test timestamp retrieval from xml"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-managed-system.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - system.processMetrics(testJson) - Instant instant = system.getTimestamp() - - then: - instant.getEpochSecond() == 1597086630 - } - -} diff --git a/src/test/groovy/biz/nellemann/hmci/MockResponses.groovy b/src/test/groovy/biz/nellemann/hmci/MockResponses.groovy new file mode 100644 index 0000000..a8079ec --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/MockResponses.groovy @@ -0,0 +1,103 @@ +package biz.nellemann.hmci + +import org.mockserver.integration.ClientAndServer +import org.mockserver.model.Header +import org.mockserver.model.HttpRequest +import org.mockserver.model.HttpResponse +import org.mockserver.model.MediaType + +class MockResponses { + + + static void prepareClientResponseForLogin(ClientAndServer mockServer) { + + File responseFile = new File("src/test/resources/hmc-logon-response.xml") + //def responseFile = new File(getClass().getResource('/hmc-logon-response.xml').toURI()) + def req = HttpRequest.request() + .withMethod("PUT") + .withPath("/rest/api/web/Logon") + + def res = HttpResponse.response() + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/vnd.ibm.powervm.web+xml; type=LogonResponse"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + } + + + static void prepareClientResponseForManagementConsole(ClientAndServer mockServer) { + File responseFile = new File("src/test/resources/1-hmc.xml") + //def responseFile = new File(getClass().getResource('/1-hmc.xml').toURI()) + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/rest/api/uom/ManagementConsole") + + def res = HttpResponse.response() + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/atom+xml; charset=UTF-8"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + } + + + static void prepareClientResponseForManagedSystem(ClientAndServer mockServer) { + File responseFile = new File("src/test/resources/2-managed-system.xml") + //def responseFile = new File(getClass().getResource('/2-managed-system.xml').toURI()) + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/rest/api/uom/ManagementConsole/[0-9a-z-]+/ManagedSystem/.*") + + def res = HttpResponse.response() + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/atom+xml; charset=UTF-8"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + } + + + static void prepareClientResponseForLogicalPartition(ClientAndServer mockServer) { + File responseFile = new File("src/test/resources/3-lpar.xml") + //def responseFile = new File(getClass().getResource('/3-lpar.xml').toURI()) + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/rest/api/uom/ManagedSystem/[0-9a-z-]+/LogicalPartition/.*") + + def res = HttpResponse.response() + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/atom+xml; charset=UTF-8"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + } + + + static void prepareClientResponseForVirtualIOServer(ClientAndServer mockServer) { + File responseFile = new File("src/test/resources/2-vios.xml") + //def responseFile = new File(getClass().getResource('/2-vios.xml').toURI()) + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/rest/api/uom/ManagedSystem/[0-9a-z-]+/VirtualIOServer/.*") + + def res = HttpResponse.response() + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/atom+xml; charset=UTF-8"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + } + + +} diff --git a/src/test/groovy/biz/nellemann/hmci/RestClientTest.groovy b/src/test/groovy/biz/nellemann/hmci/RestClientTest.groovy new file mode 100644 index 0000000..7235bab --- /dev/null +++ b/src/test/groovy/biz/nellemann/hmci/RestClientTest.groovy @@ -0,0 +1,150 @@ +package biz.nellemann.hmci; + +import org.mockserver.integration.ClientAndServer +import org.mockserver.logging.MockServerLogger +import org.mockserver.model.Header +import org.mockserver.model.HttpRequest +import org.mockserver.model.HttpResponse +import org.mockserver.model.MediaType +import org.mockserver.socket.PortFactory +import org.mockserver.socket.tls.KeyStoreFactory +import spock.lang.Shared +import spock.lang.Specification +import spock.lang.Stepwise + +import javax.net.ssl.HttpsURLConnection +import java.util.concurrent.TimeUnit + +@Stepwise +class RestClientTest extends Specification { + + @Shared + private static ClientAndServer mockServer; + + @Shared + private RestClient serviceClient + + + def setupSpec() { + HttpsURLConnection.setDefaultSSLSocketFactory(new KeyStoreFactory(new MockServerLogger()).sslContext().getSocketFactory()); + mockServer = ClientAndServer.startClientAndServer(PortFactory.findFreePort()); + serviceClient = new RestClient(String.format("http://localhost:%d", mockServer.getPort()), "user", "password", true) + } + + def cleanupSpec() { + mockServer.stop() + } + + def setup() { + mockServer.reset() + } + + + def "Test GET Request"() { + setup: + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/test/get") + def res = HttpResponse.response() + .withDelay(TimeUnit.SECONDS, 1) + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "text/plain"), + ) + .withBody("myTestData", MediaType.TEXT_PLAIN) + mockServer.when(req).respond(res) + + when: + String response = serviceClient.getRequest("/test/get") + + then: + response == "myTestData" + } + + + + def "Test POST Request"() { + setup: + def req = HttpRequest.request() + .withMethod("POST") + .withPath("/test/post") + def res = HttpResponse.response() + .withDelay(TimeUnit.SECONDS, 1) + .withStatusCode(202) + .withHeaders( + new Header("Content-Type", "text/plain; charset=UTF-8"), + ) + .withBody("Created, OK.", MediaType.TEXT_PLAIN) + mockServer.when(req).respond(res) + + when: + String response = serviceClient.postRequest("/test/post", null) + + then: + response == "Created, OK." + } + + + + def "Test HMC Login"() { + setup: + def responseFile = new File(getClass().getResource('/hmc-logon-response.xml').toURI()) + def req = HttpRequest.request() + .withMethod("PUT") + .withPath("/rest/api/web/Logon") + + def res = HttpResponse.response() + .withDelay(TimeUnit.SECONDS, 1) + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/vnd.ibm.powervm.web+xml; type=LogonResponse"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + + when: + serviceClient.login() + + then: + serviceClient.authToken == "tKVhm4YD0bS0qjaYuXI8b2ZbOvh8MlGV1Inivvwd7L3VTUyP0J3j6pLcaaW-Ek3xPWLuF2-kLZDabjUvukWyyM69ytjz6LGZRK4VI_qsz5KEfwg6weIp6olXId-S6ioNP_CcKfjwkL6HZMMWyLSmMrSA0cz7QVkvoUeBB6mAFK_LjI1SBfCXupnVEsKdFpH9FdSS4_s-LrDend__MC1Xqm9_7xq-GN_J5tiE1zwSXvY=" + } + + + + def "Test HMC Request"() { + setup: + def responseFile = new File(getClass().getResource('/1-hmc.xml').toURI()) + def req = HttpRequest.request() + .withMethod("GET") + .withPath("/rest/api/uom/ManagementConsole") + + def res = HttpResponse.response() + .withDelay(TimeUnit.SECONDS, 1) + .withStatusCode(200) + .withHeaders( + new Header("Content-Type", "application/atom+xml; charset=UTF-8"), + ) + .withBody(responseFile.getText('UTF-8'), MediaType.XML_UTF_8) + + mockServer.when(req).respond(res) + + when: + def xml = serviceClient.getRequest("/rest/api/uom/ManagementConsole") + + then: + xml == responseFile.getText('UTF-8') + } + + + def "Test HMC Logoff"() { + when: + serviceClient.logoff() + + then: + serviceClient.authToken == null + } + +} + + diff --git a/src/test/groovy/biz/nellemann/hmci/SystemEnergyTest.groovy b/src/test/groovy/biz/nellemann/hmci/SystemEnergyTest.groovy deleted file mode 100644 index 95e5304..0000000 --- a/src/test/groovy/biz/nellemann/hmci/SystemEnergyTest.groovy +++ /dev/null @@ -1,62 +0,0 @@ -package biz.nellemann.hmci - -import spock.lang.Specification - -class SystemEnergyTest extends Specification { - - void "test processPcmJson for ManagedSystem Energy"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - system.energy.processMetrics(testJson) - - then: - system.energy.metrics.systemUtil.sample.energyUtil.powerUtil.powerReading == 542.0 - system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures.first().entityId == "CPU temperature sensors(41h)" - system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures.first().temperatureReading == 54.0 - system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.inletTemperatures.first().temperatureReading == 26.0 - system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures.first().entityId == "Baseboard temperature sensors(42h)" - system.energy.metrics.systemUtil.sample.energyUtil.thermalUtil.baseboardTemperatures.first().temperatureReading == 45.0 - } - - - void "test power readings for ManagedSystem Energy"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - system.energy.processMetrics(testJson) - List measurements = system.energy.getPowerMetrics() - - then: - measurements.first().tags.get('servername') == 'Test Name' - measurements.first().fields.get('powerReading') == 542.0f - } - - - void "test thermal readings for ManagedSystem Energy"() { - - setup: - def testFile = new File(getClass().getResource('/pcm-data-energy.json').toURI()) - def testJson = testFile.getText('UTF-8') - - when: - ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N") - system.energy.processMetrics(testJson) - List measurements = system.energy.getThermalMetrics() - - then: - measurements.first().tags.get('servername') == 'Test Name' - measurements.first().fields.get('cpuTemperature_1') == 46.0f - measurements.first().fields.get('cpuTemperature_2') == 54.0f - measurements.first().fields.get('inletTemperature_1') == 26.0f - } - -} diff --git a/src/test/resources/1-hmc.xml b/src/test/resources/1-hmc.xml new file mode 100644 index 0000000..08a787b --- /dev/null +++ b/src/test/resources/1-hmc.xml @@ -0,0 +1,159 @@ + + 347ecfcf-acac-3724-8915-a3d7d7a6f298 + 2021-11-09T21:13:39.591+01:00 + + + IBM Power Systems Management Console + + 2c6b6620-e3e3-3294-aaf5-38e546ff672b + ManagementConsole + 2021-11-09T21:13:40.467+01:00 + + + IBM Power Systems Management Console + + -1874046100 + + + + + 2c6b6620-e3e3-3294-aaf5-38e546ff672b + 1636488820447 + + + + + + + 7042 + CR7 + 21D3CBC + + + + + HMC-P9 + + + + + + + + + + eth1 + 10.32.64.39 + + + + + + eth0 + 172.17.0.2 + + + + + + + 1.0 + http://www.ibm.com/xmlns/systems/power/firmware/templates/mc/2012_10/ + + + + + + 1.0 + http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/ + + + + + + 2011270432 + 0 + 0 + 1 + 942 + 9 + + + + + + 1.0 + http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/ + + D7E136AUS-1.60 + V9R1 + + + + + + + + + + + + MH01789 - HMC V9R1 Service Pack 1 Release (M921) [x86_64] + + + + + + MH01808 - iFix for HMC V9R1 M921 + + + + + + MH01810 - HMC V9R1 M930 + + + + + + MH01813 - Install fix for HMC V9R1 M910+ [x86_64] + + + + + + MH01836 - HMC V9R1 M940 + + + + + + MH01859 - HMC V9R1 M941 + + + + + + MH01876 - HMC V9R1 M942 + + + ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7XxBbXJwooDmDvOTg6jbbMvJGTmj3blTCvnHi28kCSVbMROKSZGGNh4dy5J1H65jd6En+rhXzSZeSf3C6YvZ+fBk5RUTnd1ISVT07pNVWdVCeNRqiTYzckTE1reDj/8slfYIfzt3juCYKSSq/FYAdsPGrapxQDv7HDpy4SRZYeVPefy36Sxs2zJopO+fgh1VuADM2ocFTg37/6ID61aoH127gE8Ra4FKYMSmFABAmSjGioRuECqI6gHfdWo74nOaLLsq0EclzU9d9NKUkKh8dP+y969Y7WVpVqN1h/3E40WLGX34phzbtEjvFNGgEd4wgSdNqKsJgVg6gRfuD/hLf ccfw@HMC-P9 + + + + + 6 + Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz + x86_64 + + + + + + 7957 + 2046 + + + + + diff --git a/src/test/resources/2-managed-system-2.xml b/src/test/resources/2-managed-system-2.xml new file mode 100644 index 0000000..18ebd87 --- /dev/null +++ b/src/test/resources/2-managed-system-2.xml @@ -0,0 +1,4124 @@ + + + b597e4da-2aab-3f52-8616-341d62153559 + ManagedSystem + 2022-11-20T17:07:19.642+01:00 + + + + + IBM Power Systems Management Console + + 1189616750 + + + + + b597e4da-2aab-3f52-8616-341d62153559 + 1667566364939 + + + 99 + FW950.40 (99) + + + + + Normal + Temporary + normal + Reboot + 8 + Normal + Temporary + normal + autostart + autostart + fast + none + false + b + b + autostart + SystemManagementConsole + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + false + true + false + Active + true + false + true + true + false + false + true + true + false + false + true + true + true + true + true + true + true + true + false + true + true + true + true + false + true + true + true + true + true + true + false + true + true + false + true + false + false + false + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + true + true + true + true + true + true + true + true + true + true + true + true + false + true + true + true + true + true + true + true + false + false + true + true + true + true + true + true + false + true + + + + + + 64648 + + + + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + false + false + + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + + + + + + 553713680 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C9 + U78D2.001.WZS0B5H-P1-C9 + C9 + 4190 + true + true + + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + + + + + + 553844764 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C7 + U78D2.001.WZS0B5H-P1-C7 + C7 + 4190 + true + true + + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + false + false + + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + + + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870946 + PHB 34 + 34 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713698 + Empty slot + U78D2.001.WZS0B5H-P1-C3 + U78D2.001.WZS0B5H-P1-C3 + C3 + 65535 + true + true + + + 553713698 + U78D2.001.WZS0B5H-P1-C3 + C3 + false + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870945 + PHB 33 + 33 + + + + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + 553713697 + U78D2.001.WZS0B5H-P1-C2 + C2 + false + true + 240 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870944 + PHB 32 + 32 + + + + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + 553713696 + U78D2.001.WZS0B5H-P1-C4 + C4 + false + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870942 + PHB 30 + 30 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + 553975838 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870931 + PHB 19 + 19 + + + + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + false + false + + + 553779219 + U78D2.001.WZS0B5H-P1-C11 + C11 + true + true + 48 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870930 + PHB 18 + 18 + + + + + + + + + false + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + 577D + EL58 + 5273 + EL2N + 5735 + EL58 + 5273 + EL2N + 5735 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 61696 + 3076 + 61696 + 906 + 4319 + 3 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + 553713682 + U78D2.001.WZS0B5H-P1-C10 + C10 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870929 + PHB 17 + 17 + + + + + + U78D2.001.WZS0B5H-P1 + 536870928 + PHB 16 + 16 + + + + + + + + + false + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + 5767 + 5281 + 5767 + 5281 + 5767 + 5281 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 4190 + 512 + 4190 + 832 + 32902 + 6 + 32902 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713680 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C9 + U78D2.001.WZS0B5H-P1-C9 + C9 + 4190 + true + true + + + 553713680 + U78D2.001.WZS0B5H-P1-C9 + C9 + false + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870941 + PHB 29 + 29 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + 553910301 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870940 + PHB 28 + 28 + + + + + + + + + false + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + 5767 + 5281 + 5767 + 5281 + 5767 + 5281 + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 4190 + 512 + 4190 + 832 + 32902 + 6 + 32902 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844764 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C7 + U78D2.001.WZS0B5H-P1-C7 + C7 + 4190 + true + true + + + 553844764 + U78D2.001.WZS0B5H-P1-C7 + C7 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870939 + PHB 27 + 27 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779227 + Empty slot + U78D2.001.WZS0B5H-P1-C6 + U78D2.001.WZS0B5H-P1-C6 + C6 + 65535 + true + true + + + 553779227 + U78D2.001.WZS0B5H-P1-C6 + C6 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870938 + PHB 26 + 26 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713690 + Empty slot + U78D2.001.WZS0B5H-P1-C5 + U78D2.001.WZS0B5H-P1-C5 + C5 + 65535 + true + true + + + 553713690 + U78D2.001.WZS0B5H-P1-C5 + C5 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870937 + PHB 25 + 25 + + + + + + U78D2.001.WZS0B5H-P1 + 536870936 + PHB 24 + 24 + + + + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + false + false + + + 553713688 + U78D2.001.WZS0B5H-P1-C8 + C8 + true + true + 48 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870935 + PHB 23 + 23 + + + + + + + + + false + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 33345 + 3075 + 33345 + 1202 + 4172 + 2 + 4172 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + 553713687 + U78D2.001.WZS0B5H-P1-T3 + T3 + false + false + 0 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870934 + PHB 22 + 22 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + 553975830 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870933 + PHB 21 + 21 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + 553910293 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870932 + PHB 20 + 20 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844756 + Empty slot + U78D2.001.WZS0B5H-P1-C12 + U78D2.001.WZS0B5H-P1-C12 + C12 + 65535 + true + true + + + 553844756 + U78D2.001.WZS0B5H-P1-C12 + C12 + false + true + 80 + + + + + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713698 + Empty slot + U78D2.001.WZS0B5H-P1-C3 + U78D2.001.WZS0B5H-P1-C3 + C3 + 65535 + true + true + + + 553713698 + U78D2.001.WZS0B5H-P1-C3 + C3 + false + true + 510 + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + 553713697 + U78D2.001.WZS0B5H-P1-C2 + C2 + false + true + 240 + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + 553713696 + U78D2.001.WZS0B5H-P1-C4 + C4 + false + true + 510 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + 553975838 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + false + true + 80 + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + false + false + + + 553779219 + U78D2.001.WZS0B5H-P1-C11 + C11 + true + true + 48 + + + + + + false + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + 577D + EL58 + 5273 + EL2N + 5735 + EL58 + 5273 + EL2N + 5735 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 61696 + 3076 + 61696 + 906 + 4319 + 3 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + 553713682 + U78D2.001.WZS0B5H-P1-C10 + C10 + false + true + 80 + + + + + + false + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + 5767 + 5281 + 5767 + 5281 + 5767 + 5281 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 4190 + 512 + 4190 + 832 + 32902 + 6 + 32902 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713680 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C9 + U78D2.001.WZS0B5H-P1-C9 + C9 + 4190 + true + true + + + 553713680 + U78D2.001.WZS0B5H-P1-C9 + C9 + false + true + 510 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + 553910301 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + false + true + 80 + + + + + + false + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + 5767 + 5281 + 5767 + 5281 + 5767 + 5281 + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 4190 + 512 + 4190 + 832 + 32902 + 6 + 32902 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844764 + 2-Port 10/100/1000 Base-TX Ethernet PCI Express Adapter + U78D2.001.WZS0B5H-P1-C7 + U78D2.001.WZS0B5H-P1-C7 + C7 + 4190 + true + true + + + 553844764 + U78D2.001.WZS0B5H-P1-C7 + C7 + false + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779227 + Empty slot + U78D2.001.WZS0B5H-P1-C6 + U78D2.001.WZS0B5H-P1-C6 + C6 + 65535 + true + true + + + 553779227 + U78D2.001.WZS0B5H-P1-C6 + C6 + false + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713690 + Empty slot + U78D2.001.WZS0B5H-P1-C5 + U78D2.001.WZS0B5H-P1-C5 + C5 + 65535 + true + true + + + 553713690 + U78D2.001.WZS0B5H-P1-C5 + C5 + false + true + 80 + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + false + false + + + 553713688 + U78D2.001.WZS0B5H-P1-C8 + C8 + true + true + 48 + + + + + + false + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 33345 + 3075 + 33345 + 1202 + 4172 + 2 + 4172 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + 553713687 + U78D2.001.WZS0B5H-P1-T3 + T3 + false + false + 0 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + 553975830 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + false + true + 80 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + 553910293 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + false + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844756 + Empty slot + U78D2.001.WZS0B5H-P1-C12 + U78D2.001.WZS0B5H-P1-C12 + C12 + 65535 + true + true + + + 553844756 + U78D2.001.WZS0B5H-P1-C12 + C12 + false + true + 80 + + + 1024 + + + + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + 2 + Running + Sriov + + + + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + + + + + + + + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + true + 0 + 48 + + + + + + + + + 654344194 + PHB 4226 + U78D2.001.WZS0B5H-P1-C11-T1-S2 + + + + + + 654344196 + PHB 4228 + U78D2.001.WZS0B5H-P1-C11-T1-S4 + + + + + + 654344197 + PHB 4229 + U78D2.001.WZS0B5H-P1-C11-T1-S5 + + + + + + 654344198 + PHB 4230 + U78D2.001.WZS0B5H-P1-C11-T1-S6 + + + + + + 654344199 + PHB 4231 + U78D2.001.WZS0B5H-P1-C11-T1-S7 + + + + + + 654344200 + PHB 4232 + U78D2.001.WZS0B5H-P1-C11-T1-S8 + + + + + + 654344201 + PHB 4233 + U78D2.001.WZS0B5H-P1-C11-T1-S9 + + + + + + 654344202 + PHB 4234 + U78D2.001.WZS0B5H-P1-C11-T1-S10 + + + + + + 654344203 + PHB 4235 + U78D2.001.WZS0B5H-P1-C11-T1-S11 + + + + + + 654344204 + PHB 4236 + U78D2.001.WZS0B5H-P1-C11-T1-S12 + + + + + + 654344205 + PHB 4237 + U78D2.001.WZS0B5H-P1-C11-T1-S13 + + + + + + 654344206 + PHB 4238 + U78D2.001.WZS0B5H-P1-C11-T1-S14 + + + + + + 654344207 + PHB 4239 + U78D2.001.WZS0B5H-P1-C11-T1-S15 + + + + + + 654344208 + PHB 4240 + U78D2.001.WZS0B5H-P1-C11-T1-S16 + + + + + + 654344209 + PHB 4241 + U78D2.001.WZS0B5H-P1-C11-T1-S17 + + + + + + 654344210 + PHB 4242 + U78D2.001.WZS0B5H-P1-C11-T1-S18 + + + + + + 654344211 + PHB 4243 + U78D2.001.WZS0B5H-P1-C11-T1-S19 + + + + + + 654344212 + PHB 4244 + U78D2.001.WZS0B5H-P1-C11-T1-S20 + + + + + + 654344213 + PHB 4245 + U78D2.001.WZS0B5H-P1-C11-T1-S21 + + + + + + 654344214 + PHB 4246 + U78D2.001.WZS0B5H-P1-C11-T1-S22 + + + + + + 654344215 + PHB 4247 + U78D2.001.WZS0B5H-P1-C11-T1-S23 + + + + + + 654344216 + PHB 4248 + U78D2.001.WZS0B5H-P1-C11-T1-S24 + + + + + + 654344217 + PHB 4249 + U78D2.001.WZS0B5H-P1-C11-T1-S25 + + + + + + 654344218 + PHB 4250 + U78D2.001.WZS0B5H-P1-C11-T1-S26 + + + + + + 654344219 + PHB 4251 + U78D2.001.WZS0B5H-P1-C11-T1-S27 + + + + + + 654344220 + PHB 4252 + U78D2.001.WZS0B5H-P1-C11-T1-S28 + + + + + + 654344221 + PHB 4253 + U78D2.001.WZS0B5H-P1-C11-T1-S29 + + + + + + 654344222 + PHB 4254 + U78D2.001.WZS0B5H-P1-C11-T1-S30 + + + + + + 654344223 + PHB 4255 + U78D2.001.WZS0B5H-P1-C11-T1-S31 + + + + + + 654344224 + PHB 4256 + U78D2.001.WZS0B5H-P1-C11-T1-S32 + + + + + + 654344225 + PHB 4257 + U78D2.001.WZS0B5H-P1-C11-T1-S33 + + + + + + 654344226 + PHB 4258 + U78D2.001.WZS0B5H-P1-C11-T1-S34 + + + + + + 654344227 + PHB 4259 + U78D2.001.WZS0B5H-P1-C11-T1-S35 + + + + + + 654344228 + PHB 4260 + U78D2.001.WZS0B5H-P1-C11-T1-S36 + + + + + + 654344229 + PHB 4261 + U78D2.001.WZS0B5H-P1-C11-T1-S37 + + + + + + 654344230 + PHB 4262 + U78D2.001.WZS0B5H-P1-C11-T1-S38 + + + + + + 654344231 + PHB 4263 + U78D2.001.WZS0B5H-P1-C11-T1-S39 + + + + + + 654344232 + PHB 4264 + U78D2.001.WZS0B5H-P1-C11-T1-S40 + + + + + + 654344233 + PHB 4265 + U78D2.001.WZS0B5H-P1-C11-T1-S41 + + + + + + 654344234 + PHB 4266 + U78D2.001.WZS0B5H-P1-C11-T1-S42 + + + + + + 654344235 + PHB 4267 + U78D2.001.WZS0B5H-P1-C11-T1-S43 + + + + + + 654344236 + PHB 4268 + U78D2.001.WZS0B5H-P1-C11-T1-S44 + + + + + + 654344237 + PHB 4269 + U78D2.001.WZS0B5H-P1-C11-T1-S45 + + + + + + 654344238 + PHB 4270 + U78D2.001.WZS0B5H-P1-C11-T1-S46 + + + + + + 654344239 + PHB 4271 + U78D2.001.WZS0B5H-P1-C11-T1-S47 + + + + + + 654344240 + PHB 4272 + U78D2.001.WZS0B5H-P1-C11-T1-S48 + + + MAX_MIN_CAPACITY + + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + 1 + Running + Sriov + + + + + + + + + Auto + E_9000 + fullDuplex + Veb + Unknown + Veb + + U78D2.001.WZS0B5H-P1-C8-T1 + 1 + 1 + 0 + IEEE8021Q_Priority + Pvid + Mac Vlan ACL Restriction + Clear Physical Port Stat + Clear Logical Port Stat + Cna + 20 + Clients + E10Gbps + Auto + E_1500 + E_9000 + autoDuplex + fullDuplex + promiscousMode + receiveFlowControl + transmitFlowControl + Veb + Vepa + 0 + false + 2.0% + 20 + 1 + 4094 + 4094 + 200 + 2 + 2 + 20 + 20 + 4 + ALLOW_ALL + DENY_VLAN_TAGGED + ALLOW_SPECIFIED + ALLOW_ALL_OS_DEFINED + DENY_ALL_OS_DEFINED + SPECIFY_ALLOWABLE_OS_DEFINED + 0 + 256 + 128 + 0 + 1000 + 64 + 0 + 0 + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + + + + + + + + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + + + + Auto + E_9000 + autoDuplex + Veb + Unknown + Veb + + + true + 0 + 48 + + + + + + + + + 654327810 + PHB 4098 + U78D2.001.WZS0B5H-P1-C8-T1-S2 + + + + + + 654327811 + PHB 4099 + U78D2.001.WZS0B5H-P1-C8-T1-S3 + + + + + + 654327813 + PHB 4101 + U78D2.001.WZS0B5H-P1-C8-T1-S5 + + + + + + 654327814 + PHB 4102 + U78D2.001.WZS0B5H-P1-C8-T1-S6 + + + + + + 654327815 + PHB 4103 + U78D2.001.WZS0B5H-P1-C8-T1-S7 + + + + + + 654327816 + PHB 4104 + U78D2.001.WZS0B5H-P1-C8-T1-S8 + + + + + + 654327817 + PHB 4105 + U78D2.001.WZS0B5H-P1-C8-T1-S9 + + + + + + 654327818 + PHB 4106 + U78D2.001.WZS0B5H-P1-C8-T1-S10 + + + + + + 654327819 + PHB 4107 + U78D2.001.WZS0B5H-P1-C8-T1-S11 + + + + + + 654327820 + PHB 4108 + U78D2.001.WZS0B5H-P1-C8-T1-S12 + + + + + + 654327821 + PHB 4109 + U78D2.001.WZS0B5H-P1-C8-T1-S13 + + + + + + 654327822 + PHB 4110 + U78D2.001.WZS0B5H-P1-C8-T1-S14 + + + + + + 654327823 + PHB 4111 + U78D2.001.WZS0B5H-P1-C8-T1-S15 + + + + + + 654327824 + PHB 4112 + U78D2.001.WZS0B5H-P1-C8-T1-S16 + + + + + + 654327825 + PHB 4113 + U78D2.001.WZS0B5H-P1-C8-T1-S17 + + + + + + 654327826 + PHB 4114 + U78D2.001.WZS0B5H-P1-C8-T1-S18 + + + + + + 654327827 + PHB 4115 + U78D2.001.WZS0B5H-P1-C8-T1-S19 + + + + + + 654327828 + PHB 4116 + U78D2.001.WZS0B5H-P1-C8-T1-S20 + + + + + + 654327829 + PHB 4117 + U78D2.001.WZS0B5H-P1-C8-T1-S21 + + + + + + 654327830 + PHB 4118 + U78D2.001.WZS0B5H-P1-C8-T1-S22 + + + + + + 654327831 + PHB 4119 + U78D2.001.WZS0B5H-P1-C8-T1-S23 + + + + + + 654327832 + PHB 4120 + U78D2.001.WZS0B5H-P1-C8-T1-S24 + + + + + + 654327833 + PHB 4121 + U78D2.001.WZS0B5H-P1-C8-T1-S25 + + + + + + 654327834 + PHB 4122 + U78D2.001.WZS0B5H-P1-C8-T1-S26 + + + + + + 654327835 + PHB 4123 + U78D2.001.WZS0B5H-P1-C8-T1-S27 + + + + + + 654327836 + PHB 4124 + U78D2.001.WZS0B5H-P1-C8-T1-S28 + + + + + + 654327837 + PHB 4125 + U78D2.001.WZS0B5H-P1-C8-T1-S29 + + + + + + 654327838 + PHB 4126 + U78D2.001.WZS0B5H-P1-C8-T1-S30 + + + + + + 654327839 + PHB 4127 + U78D2.001.WZS0B5H-P1-C8-T1-S31 + + + + + + 654327840 + PHB 4128 + U78D2.001.WZS0B5H-P1-C8-T1-S32 + + + + + + 654327841 + PHB 4129 + U78D2.001.WZS0B5H-P1-C8-T1-S33 + + + + + + 654327842 + PHB 4130 + U78D2.001.WZS0B5H-P1-C8-T1-S34 + + + + + + 654327843 + PHB 4131 + U78D2.001.WZS0B5H-P1-C8-T1-S35 + + + + + + 654327844 + PHB 4132 + U78D2.001.WZS0B5H-P1-C8-T1-S36 + + + + + + 654327845 + PHB 4133 + U78D2.001.WZS0B5H-P1-C8-T1-S37 + + + + + + 654327846 + PHB 4134 + U78D2.001.WZS0B5H-P1-C8-T1-S38 + + + + + + 654327847 + PHB 4135 + U78D2.001.WZS0B5H-P1-C8-T1-S39 + + + + + + 654327848 + PHB 4136 + U78D2.001.WZS0B5H-P1-C8-T1-S40 + + + + + + 654327849 + PHB 4137 + U78D2.001.WZS0B5H-P1-C8-T1-S41 + + + + + + 654327850 + PHB 4138 + U78D2.001.WZS0B5H-P1-C8-T1-S42 + + + + + + 654327851 + PHB 4139 + U78D2.001.WZS0B5H-P1-C8-T1-S43 + + + + + + 654327852 + PHB 4140 + U78D2.001.WZS0B5H-P1-C8-T1-S44 + + + + + + 654327853 + PHB 4141 + U78D2.001.WZS0B5H-P1-C8-T1-S45 + + + + + + 654327854 + PHB 4142 + U78D2.001.WZS0B5H-P1-C8-T1-S46 + + + + + + 654327855 + PHB 4143 + U78D2.001.WZS0B5H-P1-C8-T1-S47 + + + + + + 654327856 + PHB 4144 + U78D2.001.WZS0B5H-P1-C8-T1-S48 + + + MAX_MIN_CAPACITY + + + + + + + + + + + 1A53C6 + + + + + + + + C050760B1D10 + + + + + + 5 + 6 + 7 + 8 + 9 + 1:256,1:512,1:1024,1:2048,1:4096,1:8192 + auto,16,32,64,128,256 + 0 + 1048576 + 0 + 0 + 0 + 66048 + 256 + none + 0 + 0 + 6 + 7 + 10 + 0 + 16384 + 1048576 + 63 + 1 + 0 + 2 + Not_In_Progress + Off + 256 + 40448 + 0 + 0 + 0 + 0 + 66048 + 256 + none + 256 + 0 + false + 6 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 1048576 + 942080 + + + + + + 24 + 4.65 + 64 + 64 + 256 + 64 + 64 + 64 + 64 + 0 + 24 + 0 + 256 + 0.05 + 24 + 0 + 0 + 0 + 4.65 + 64 + default + POWER7 + POWER8 + POWER9 + POWER9_Base + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 24 + + + + + + 32 + 2 + 1 + 60 + 60 + + + + + + None + + + + + 9009 + 42A + 21F64EV + + false + 480 + 1 + 480 + 65535 + 0 + 6 + true + 10.32.64.189 + 10.32.64.189 + false + 11 + unsupported + 00090005 + operating + Server-9009-42A-SN21F64EV + 1668960146866 + true + + + + + Enabled + 16 + 8 + 0 + 0 + 16 + true + PartitionConfiguration + + + + VL950_FW950.40 (99) + + + + + Static + Static + Static + Dynamic_Performance + Maximum_Performance + true + + + + + 98.0% + 98.0% + 16 + 0.8% + 0.8% + 18.0% + 98.0% + false + 10.0% + 0.0% + 0.0% + 1 + 0.1% + 0.1% + 0.0% + 0.0% + 10.0% + 100.0% + 100.0% + 1024 + 100.0% + 100.0% + 100.0% + 100.0% + 100.0% + + + + + + 240 + 10 + 8.0% + 12.0% + 10 + 10 + 1.0% + 5.0% + 600 + 600 + 95.0% + 95.0% + + + false + true + false + false + false + false + false + false + false + false + + + + + + + + + gzip + 128 + 128 + 128 + + + 12.85 + 940288 + 4 + 64 + + + fsp + false + + + + + 16384 + 0 + 964 + 0 + 964 + 256 + 0 + 0 + dram + + + + diff --git a/src/test/resources/2-managed-system-perf-data.json b/src/test/resources/2-managed-system-perf-data.json new file mode 100644 index 0000000..53dc5a8 --- /dev/null +++ b/src/test/resources/2-managed-system-perf-data.json @@ -0,0 +1,805 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-10T21:10:30+0200", + "endTimeStamp": "2020-08-10T21:10:30+0200", + "mtms": "8247-22L*213C1BA", + "name": "S822L-8247-213C1BA", + "uuid": "e09834d1-c930-3883-bdad-405d8e26e166", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "ManagedSystem", + "sampleInfo": { + "timeStamp": "2020-08-10T21:10:30+0200", + "status": 0 + }, + "systemFirmwareUtil": { + "utilizedProcUnits": [ + 0.000 + ], + "assignedMem": [ + 5632.000 + ] + }, + "serverUtil": { + "processor": { + "totalProcUnits": [ + 24.000 + ], + "utilizedProcUnits": [ + 0.027 + ], + "availableProcUnits": [ + 16.000 + ], + "configurableProcUnits": [ + 24.000 + ] + }, + "memory": { + "totalMem": [ + 1048576.000 + ], + "availableMem": [ + 1001984.000 + ], + "configurableMem": [ + 1048576.000 + ], + "assignedMemToLpars": [ + 40960.000 + ] + }, + "physicalProcessorPool": { + "assignedProcUnits": [ + 23.767 + ], + "utilizedProcUnits": [ + 0.007 + ], + "availableProcUnits": [ + 23.760 + ], + "configuredProcUnits": [ + 0.000 + ], + "borrowedProcUnits": [ + 16.000 + ] + }, + "sharedProcessorPool": [ + { + "id": 0, + "name": "DefaultPool", + "assignedProcUnits": [ + 23.767 + ], + "utilizedProcUnits": [ + 0.006 + ], + "availableProcUnits": [ + 23.761 + ], + "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": [ + 2093.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.011 + ], + "utilizedCappedProcUnits": [ + 0.120 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.109 + ], + "donatedProcUnits": [ + 0.880 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 50.000 + ] + }, + "network": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericAdapters": [ + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C10-T3", + "receivedPackets": [ + 13.100 + ], + "sentPackets": [ + 8.700 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3511.833 + ], + "receivedBytes": [ + 1614.567 + ], + "transferredBytes": [ + 5126.400 + ] + }, + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C3-T1", + "receivedPackets": [ + 5.733 + ], + "sentPackets": [ + 1.600 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1378.267 + ], + "receivedBytes": [ + 490.500 + ], + "transferredBytes": [ + 1868.767 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 9.700 + ], + "sentPackets": [ + 17.200 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 4835.967 + ], + "receivedBytes": [ + 4217.833 + ], + "transferredBytes": [ + 9053.800 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V1-C2-T1", + "receivedPackets": [ + 22.800 + ], + "sentPackets": [ + 25.900 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 8347.800 + ], + "receivedBytes": [ + 5832.400 + ], + "transferredBytes": [ + 14180.200 + ], + "bridgedAdapters": [ + "ent2", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U8247.22L.213C1BA-V1-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 16.167 + ], + "sentPackets": [ + 20.133 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 3155.500 + ], + "receivedBytes": [ + 5089.900 + ], + "receivedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalPackets": [ + 0.000 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 0.000 + ], + "receivedPhysicalBytes": [ + 0.000 + ], + "transferredBytes": [ + 8245.400 + ], + "transferredPhysicalBytes": [ + 0.000 + ] + }, + { + "physicalLocation": "U8247.22L.213C1BA-V1-C3", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 8.800 + ], + "sentPackets": [ + 4.567 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 2086.400 + ], + "receivedBytes": [ + 1169.400 + ], + "receivedPhysicalPackets": [ + 8.800 + ], + "sentPhysicalPackets": [ + 4.567 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 2086.400 + ], + "receivedPhysicalBytes": [ + 1169.400 + ], + "transferredBytes": [ + 3255.800 + ], + "transferredPhysicalBytes": [ + 3255.800 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas0", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C14-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 19.467 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 9966.933 + ], + "transmittedBytes": [ + 9966.933 + ] + } + ], + "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.467 + ], + "numOfWrites": [ + 0.467 + ], + "readBytes": [ + 238.933 + ], + "writeBytes": [ + 238.933 + ], + "transmittedBytes": [ + 477.866 + ] + }, + { + "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.067 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 4369.067 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 4369.067 + ] + }, + { + "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": [ + 2116.000 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs_active", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 0.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.009 + ], + "utilizedCappedProcUnits": [ + 0.113 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.104 + ], + "donatedProcUnits": [ + 0.887 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 51.000 + ] + }, + "network": { + "genericAdapters": [ + { + "id": "ent6", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C3-T1", + "receivedPackets": [ + 5.967 + ], + "sentPackets": [ + 1.967 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1340.100 + ], + "receivedBytes": [ + 536.100 + ], + "transferredBytes": [ + 1876.200 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 4.667 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3294.667 + ], + "transferredBytes": [ + 4000.667 + ] + }, + { + "id": "ent2", + "type": "physical", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C6-T3", + "receivedPackets": [ + 6.000 + ], + "sentPackets": [ + 0.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 0.000 + ], + "receivedBytes": [ + 420.167 + ], + "transferredBytes": [ + 420.167 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U8247.22L.213C1BA-V2-C2-T1", + "receivedPackets": [ + 10.667 + ], + "sentPackets": [ + 1.000 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 706.000 + ], + "receivedBytes": [ + 3714.833 + ], + "transferredBytes": [ + 4420.833 + ], + "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": [ + 8.467 + ], + "sentPackets": [ + 4.333 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 1849.500 + ], + "receivedBytes": [ + 1100.000 + ], + "receivedPhysicalPackets": [ + 8.467 + ], + "sentPhysicalPackets": [ + 4.333 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 1849.500 + ], + "receivedPhysicalBytes": [ + 1100.000 + ], + "transferredBytes": [ + 2949.500 + ], + "transferredPhysicalBytes": [ + 2949.500 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "62F4D488-C838-41E2-B83B-E68E004E3B63" + ], + "genericPhysicalAdapters": [ + { + "id": "sissas1", + "type": "sas", + "physicalLocation": "U78CB.001.WZS0BYF-P1-C15-T1", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 12.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6144.000 + ], + "transmittedBytes": [ + 6144.000 + ] + } + ], + "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.067 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 4369.067 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 4369.067 + ] + } + ] + } + } + ] + } + ] + } +} diff --git a/src/test/resources/2-managed-system-perf-data2.json b/src/test/resources/2-managed-system-perf-data2.json new file mode 100644 index 0000000..7ec2b85 --- /dev/null +++ b/src/test/resources/2-managed-system-perf-data2.json @@ -0,0 +1,1273 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2022-11-19T18:35:00+0100", + "endTimeStamp": "2022-11-19T18:35:00+0100", + "mtms": "9009-42A*21F64EV", + "name": "Server-9009-42A-SN21F64EV", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "ManagedSystem", + "sampleInfo": { + "timeStamp": "2022-11-19T18:35:00+0100", + "status": 2, + "errorInfo": [ + { + "errId": "4005", + "errMsg": "RMC is INACTIVE on vios: 2 on Managed System: 9009-42A*21F64EV", + "uuid": "19D6097E-763E-4B64-A48A-A285B21E1D0C", + "reportedBy": "VirtualIOServer", + "occurrenceCount": 1 + } + ] + }, + "systemFirmwareUtil": { + "utilizedProcUnits": [ + 0.00458 + ], + "assignedMem": [ + 40448 + ] + }, + "serverUtil": { + "processor": { + "totalProcUnits": [ + 24 + ], + "utilizedProcUnits": [ + 1.08019 + ], + "availableProcUnits": [ + 4.65 + ], + "configurableProcUnits": [ + 24 + ] + }, + "memory": { + "totalMem": [ + 1048576 + ], + "availableMem": [ + 66048 + ], + "configurableMem": [ + 1048576 + ], + "assignedMemToLpars": [ + 942080 + ], + "virtualPersistentMem": [ + 0 + ] + }, + "physicalProcessorPool": { + "assignedProcUnits": [ + 22 + ], + "utilizedProcUnits": [ + 0.04913 + ], + "availableProcUnits": [ + 21.95087 + ], + "configuredProcUnits": [ + 0 + ], + "borrowedProcUnits": [ + 4 + ] + }, + "sharedProcessorPool": [ + { + "id": 0, + "name": "DefaultPool", + "assignedProcUnits": [ + 22.00013 + ], + "utilizedProcUnits": [ + 0.03897 + ], + "availableProcUnits": [ + 21.96116 + ], + "configuredProcUnits": [ + 14.35 + ], + "borrowedProcUnits": [ + 4 + ] + }, + { + "id": 1, + "name": "SharedPool01", + "assignedProcUnits": [ + 4.00002 + ], + "utilizedProcUnits": [ + 0 + ], + "availableProcUnits": [ + 4.00002 + ] + }, + { + "id": 2, + "name": "SharedPool02", + "assignedProcUnits": [ + 4.00002 + ], + "utilizedProcUnits": [ + 0 + ], + "availableProcUnits": [ + 4.00002 + ] + }, + { + "id": 3, + "name": "SharedPool03", + "assignedProcUnits": [ + 1.00001 + ], + "utilizedProcUnits": [ + 0 + ], + "availableProcUnits": [ + 1.00001 + ], + "configuredProcUnits": [ + 1 + ] + } + ], + "network": { + "sriovAdapters": [ + { + "drcIndex": "553779219", + "physicalPorts": [ + { + "id": 3, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T4", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 2, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T3", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 1, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T2", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 0, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T1", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + } + ] + }, + { + "drcIndex": "553713688", + "physicalPorts": [ + { + "id": 0, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T1", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 1, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T2", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 2, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T3", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "id": 3, + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T4", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + } + ] + } + ] + } + }, + "viosUtil": [ + { + "id": 1, + "uuid": "6B1BF965-26DE-42F1-83AC-58C2A95D221C", + "name": "P924VIO1", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 4096 + ], + "utilizedMem": [ + 2941 + ], + "virtualPersistentMem": [ + 0 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs", + "maxVirtualProcessors": [ + 2 + ], + "currentVirtualProcessors": [ + 0 + ], + "maxProcUnits": [ + 2 + ], + "entitledProcUnits": [ + 1 + ], + "utilizedProcUnits": [ + 0.03542 + ], + "utilizedCappedProcUnits": [ + 1 + ], + "utilizedUncappedProcUnits": [ + 0 + ], + "idleProcUnits": [ + 0.96458 + ], + "donatedProcUnits": [ + 0 + ], + "timeSpentWaitingForDispatch": [ + 0 + ], + "timePerInstructionExecution": [ + 2 + ] + }, + "network": { + "clientLpars": [ + "07F4342319494029801548C492523860", + "2C1D43AF-C6EC-49E5-AF8E-FE3A5879D356", + "07F43423-1949-4029-8015-48C492523860" + ], + "genericAdapters": [ + { + "id": "ent8", + "type": "physical", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C7-T2", + "receivedPackets": [ + 4.767 + ], + "sentPackets": [ + 2.833 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 1146 + ], + "receivedBytes": [ + 654.967 + ], + "transferredBytes": [ + 1800.967 + ] + }, + { + "id": "ent4", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C2-T1", + "receivedPackets": [ + 1.1 + ], + "sentPackets": [ + 8.633 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 4128.267 + ], + "receivedBytes": [ + 584.067 + ], + "transferredBytes": [ + 4712.334 + ] + }, + { + "id": "ent7", + "type": "physical", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C7-T1", + "receivedPackets": [ + 3.667 + ], + "sentPackets": [ + 1.1 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 542.567 + ], + "receivedBytes": [ + 290.333 + ], + "transferredBytes": [ + 832.9 + ] + } + ], + "sharedAdapters": [ + { + "id": "ent5", + "type": "sea", + "physicalLocation": "U9009.42A.21F64EV-V1-C2-T1", + "receivedPackets": [ + 4.767 + ], + "sentPackets": [ + 9.733 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 4670.833 + ], + "receivedBytes": [ + 874.4 + ], + "transferredBytes": [ + 5545.233 + ], + "bridgedAdapters": [ + "ent7", + "ent4", + "ent4" + ] + } + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U9009.42A.21F64EV-V1-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 1.133 + ], + "sentPackets": [ + 3.1 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 261.433 + ], + "receivedBytes": [ + 586.7 + ], + "receivedPhysicalPackets": [ + 0 + ], + "sentPhysicalPackets": [ + 0 + ], + "droppedPhysicalPackets": [ + 0 + ], + "sentPhysicalBytes": [ + 0 + ], + "receivedPhysicalBytes": [ + 0 + ], + "transferredBytes": [ + 848.133 + ], + "transferredPhysicalBytes": [ + 0 + ] + } + ], + "sriovLogicalPorts": [ + { + "drcIndex": "654327812", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T1-S4", + "physicalDrcIndex": "553713688", + "physicalPortId": 0, + "clientPartitionUUID": "07F4342319494029801548C492523860", + "vnicDeviceMode": "NonVNIC", + "configurationType": "Ethernet", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "drcIndex": "654344195", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T1-S3", + "physicalDrcIndex": "553779219", + "physicalPortId": 0, + "clientPartitionUUID": "07F4342319494029801548C492523860", + "vnicDeviceMode": "NonVNIC", + "configurationType": "Ethernet", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + }, + { + "drcIndex": "654327809", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C8-T2-S1", + "physicalDrcIndex": "553713688", + "physicalPortId": 1, + "clientPartitionUUID": "07F4342319494029801548C492523860", + "vnicDeviceMode": "NonVNIC", + "configurationType": "Ethernet", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "2C1D43AF-C6EC-49E5-AF8E-FE3A5879D356", + "07F43423-1949-4029-8015-48C492523860" + ], + "genericPhysicalAdapters": [ + { + "id": "usbhc0", + "type": "sas", + "physicalLocation": "U78D2.001.WZS0B5H-P1", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "nvme0", + "type": "sas", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C50-C1", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 46.133 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 23620.267 + ], + "transmittedBytes": [ + 23620.267 + ] + } + ], + "genericVirtualAdapters": [ + { + "id": "vhost0", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C3", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost9", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C26", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost18", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C48", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost6", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C15", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost5", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C8", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost1", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C4", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost2", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C5", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost3", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C6", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost4", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C7", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost16", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C47", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost11", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C14", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost8", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C11", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost12", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C34", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost7", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C12", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + }, + { + "id": "vhost17", + "type": "virtual", + "physicalLocation": "U9009.42A.21F64EV-V1-C95", + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + } + ], + "fiberChannelAdapters": [ + { + "id": "fcs0", + "wwpn": "100000109b89aca8", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C2-T1", + "numOfPorts": 5, + "numOfReads": [ + 0.667 + ], + "numOfWrites": [ + 0.6 + ], + "readBytes": [ + 36120.533 + ], + "writeBytes": [ + 2696.533 + ], + "runningSpeed": [ + 17 + ], + "transmittedBytes": [ + 38817.066 + ] + }, + { + "id": "fcs1", + "wwpn": "100000109b89aca9", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C2-T2", + "numOfPorts": 5, + "numOfReads": [ + 0.367 + ], + "numOfWrites": [ + 0.7 + ], + "readBytes": [ + 36078.933 + ], + "writeBytes": [ + 3276.8 + ], + "runningSpeed": [ + 17 + ], + "transmittedBytes": [ + 39355.733 + ] + }, + { + "id": "fcs2", + "wwpn": "0000000000000000", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C2-T2", + "numOfPorts": 0, + "numOfReads": [ + 0 + ], + "numOfWrites": [ + 0 + ], + "readBytes": [ + 0 + ], + "writeBytes": [ + 0 + ], + "runningSpeed": [ + 0 + ], + "transmittedBytes": [ + 0 + ] + } + ] + } + }, + { + "id": 2, + "uuid": "19D6097E-763E-4B64-A48A-A285B21E1D0C", + "name": "P924VIO2", + "state": "Running", + "affinityScore": 100, + "memory": { + "assignedMem": [ + 4096 + ], + "utilizedMem": [ + 0 + ], + "virtualPersistentMem": [ + 0 + ] + }, + "processor": { + "weight": 0, + "mode": "share_idle_procs", + "maxVirtualProcessors": [ + 2 + ], + "currentVirtualProcessors": [ + 0 + ], + "maxProcUnits": [ + 2 + ], + "entitledProcUnits": [ + 1 + ], + "utilizedProcUnits": [ + 1 + ], + "utilizedCappedProcUnits": [ + 1 + ], + "utilizedUncappedProcUnits": [ + 0 + ], + "idleProcUnits": [ + 0 + ], + "donatedProcUnits": [ + 0 + ], + "timeSpentWaitingForDispatch": [ + 0 + ], + "timePerInstructionExecution": [ + 0 + ] + }, + "network": { + "clientLpars": [ + "07F4342319494029801548C492523860" + ], + "virtualEthernetAdapters": [ + { + "physicalLocation": "U9009.42A.21F64EV-V2-C2", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "receivedPhysicalPackets": [ + 0 + ], + "sentPhysicalPackets": [ + 0 + ], + "droppedPhysicalPackets": [ + 0 + ], + "sentPhysicalBytes": [ + 0 + ], + "receivedPhysicalBytes": [ + 0 + ], + "transferredBytes": [ + 0 + ], + "transferredPhysicalBytes": [ + 0 + ] + } + ], + "sriovLogicalPorts": [ + { + "drcIndex": "654344193", + "physicalLocation": "U78D2.001.WZS0B5H-P1-C11-T2-S1", + "physicalDrcIndex": "553779219", + "physicalPortId": 1, + "clientPartitionUUID": "07F4342319494029801548C492523860", + "vnicDeviceMode": "NonVNIC", + "configurationType": "Ethernet", + "receivedPackets": [ + 0 + ], + "sentPackets": [ + 0 + ], + "droppedPackets": [ + 0 + ], + "sentBytes": [ + 0 + ], + "receivedBytes": [ + 0 + ], + "errorIn": [ + 0 + ], + "errorOut": [ + 0 + ], + "transferredBytes": [ + 0 + ] + } + ] + }, + "storage": { + "clientLpars": [ + "2C1D43AF-C6EC-49E5-AF8E-FE3A5879D356", + "07F43423-1949-4029-8015-48C492523860" + ] + } + } + ] + } + ] + } +} diff --git a/src/test/resources/2-managed-system-perf-feed.xml b/src/test/resources/2-managed-system-perf-feed.xml new file mode 100644 index 0000000..8863647 --- /dev/null +++ b/src/test/resources/2-managed-system-perf-feed.xml @@ -0,0 +1,206 @@ + + b597e4da-2aab-3f52-8616-341d62153559 + 2022-11-19T13:02:30.000+01:00 + ProcessedMetrics + ManagedSystem b597e4da-2aab-3f52-8616-341d62153559 + + + + d9be911d-6e9a-4e8a-a2de-1ddd3e6c6791 + 2022-11-19T13:02:30.000+01:00 + ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20221119T130230+0100_20221119T130230+0100_30.json + 2022-11-19T13:02:30.000+01:00 + + + IBM Power Systems Management Console + + + + + e05ecd56-5133-4646-b9b0-cae3575b9ac9 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_07F43423-1949-4029-8015-48C492523860 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 44332b8d-64dc-46ed-b64c-2a24ec97bf70 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_0ADFFB82-B765-4B24-BE35-38D9EE1E3E81 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + fa689d8d-3829-4e36-9406-5dd638b58b16 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_1700D42D-C9FA-4131-B024-588FDDC70649 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 95fec810-ab55-4ee9-8fee-81ebd2d4e302 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_244A839D-987B-4539-AE14-684D0E99BA32 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 6686e889-6e0b-44f6-a485-f86c05cf58a6 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_2A379B8A-C6E0-415E-9601-9832251F616F + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + ae727105-1c00-4ded-a654-d10b5196b831 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_2C1D43AF-C6EC-49E5-AF8E-FE3A5879D356 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + dd36ab9d-60f6-4be3-bd5c-e48b557e0b5e + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_2DE05DB6-8AD5-448F-8327-0F488D287E82 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + ac88d888-3f1f-49c5-9562-f6249afa9ed8 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_396117F4-A59F-44E1-945C-B8B9EE9ABD29 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 7d3e2040-6fe3-4740-94f5-6d07cc82c033 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_42108956-78CB-4040-A291-DF872B49268F + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 9b7b4058-5918-418b-9a3e-afa5216fb19e + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_44A89632-E9E6-4E12-91AF-1A33DEE060CF + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 1f6d8030-01ae-46f8-947c-e7dbe46604cc + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_4BFD7A69-20CA-4434-935C-9A122C77CB70 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + d49181c9-d081-4b5c-9b3e-112746c00852 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_50C81B10-0E86-442F-A989-574D10C9F38D + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 40fdb500-14e9-422d-a27a-27b8218d388b + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_517C22CF-7EB1-4D29-A54C-6C7085CBBAA7 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + d73118e9-c3dc-4845-9b6d-d8b366a4066c + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_5F170610-8233-4B9F-8AA8-2E460D2601AE + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 6a3911da-3c58-41af-96b1-25d63b43d151 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_6D775DB5-010B-4B7C-B585-BB7C9128D259 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + da5a7b1c-f7c2-45f1-99b7-040e41965c3e + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_705DF991-1A8B-4379-B722-7B6265DA6C8C + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + + 48db2d74-865c-47ed-9d11-0a712695f265 + 2022-11-19T13:03:09.564+01:00 + LogicalPartition_75E900B0-06E2-4C67-A158-0198B4264304 + 2022-11-19T13:03:09.564+01:00 + + + IBM Power Systems Management Console + + + + diff --git a/src/test/resources/2-managed-system.xml b/src/test/resources/2-managed-system.xml new file mode 100644 index 0000000..1e2af15 --- /dev/null +++ b/src/test/resources/2-managed-system.xml @@ -0,0 +1,2804 @@ + + b597e4da-2aab-3f52-8616-341d62153559 + ManagedSystem + 2021-11-09T21:19:56.175+01:00 + + + + + IBM Power Systems Management Console + + -1745013110 + + + + + b597e4da-2aab-3f52-8616-341d62153559 + 1634214338991 + + + 145 + FW930.50 (145) + + + + + Normal + Temporary + normal + Reboot + 8 + Normal + Temporary + normal + autostart + autostart + fast + none + false + b + b + autostart + SystemManagementConsole + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + false + true + false + Active + true + false + true + true + false + true + true + true + true + true + true + true + true + false + true + true + true + true + false + true + true + true + true + true + true + false + true + true + false + true + false + false + false + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + true + true + true + true + true + true + true + true + true + true + true + true + false + true + true + true + true + true + true + false + false + false + true + true + true + false + false + + + + + + 64960 + + + + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + true + true + + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + true + true + + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + + + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870928 + PHB 16 + 16 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713680 + Empty slot + U78D2.001.WZS0B5H-P1-C9 + U78D2.001.WZS0B5H-P1-C9 + C9 + 65535 + true + true + + + 553713680 + U78D2.001.WZS0B5H-P1-C9 + C9 + false + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870929 + PHB 17 + 17 + + + + + + U78D2.001.WZS0B5H-P1 + 536870930 + PHB 18 + 18 + + + + + + + + + false + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + 577D + EL58 + 5273 + EL2N + 5735 + EL58 + 5273 + EL2N + 5735 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 61696 + 3076 + 61696 + 906 + 4319 + 3 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + 553713682 + U78D2.001.WZS0B5H-P1-C10 + C10 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870931 + PHB 19 + 19 + + + + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + true + true + + + 553779219 + U78D2.001.WZS0B5H-P1-C11 + C11 + true + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870932 + PHB 20 + 20 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844756 + Empty slot + U78D2.001.WZS0B5H-P1-C12 + U78D2.001.WZS0B5H-P1-C12 + C12 + 65535 + true + true + + + 553844756 + U78D2.001.WZS0B5H-P1-C12 + C12 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870933 + PHB 21 + 21 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + 553910293 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870934 + PHB 22 + 22 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + 553975830 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870935 + PHB 23 + 23 + + + + + + + + + false + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H + 10 + P9-PowerVC + AIX/Linux + 33345 + 3075 + 33345 + 1202 + 4172 + 2 + 4172 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + 553713687 + U78D2.001.WZS0B5H-P1-T3 + T3 + false + false + 0 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870936 + PHB 24 + 24 + + + + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + true + true + + + 553713688 + U78D2.001.WZS0B5H-P1-C8 + C8 + true + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870937 + PHB 25 + 25 + + + + + + U78D2.001.WZS0B5H-P1 + 536870938 + PHB 26 + 26 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713690 + Empty slot + U78D2.001.WZS0B5H-P1-C5 + U78D2.001.WZS0B5H-P1-C5 + C5 + 65535 + true + true + + + 553713690 + U78D2.001.WZS0B5H-P1-C5 + C5 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870939 + PHB 27 + 27 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779227 + Empty slot + U78D2.001.WZS0B5H-P1-C6 + U78D2.001.WZS0B5H-P1-C6 + C6 + 65535 + true + true + + + 553779227 + U78D2.001.WZS0B5H-P1-C6 + C6 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870940 + PHB 28 + 28 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844764 + Empty slot + U78D2.001.WZS0B5H-P1-C7 + U78D2.001.WZS0B5H-P1-C7 + C7 + 65535 + true + true + + + 553844764 + U78D2.001.WZS0B5H-P1-C7 + C7 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870941 + PHB 29 + 29 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + 553910301 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870942 + PHB 30 + 30 + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + 553975838 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + false + true + 80 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870944 + PHB 32 + 32 + + + + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + 553713696 + U78D2.001.WZS0B5H-P1-C4 + C4 + false + true + 510 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870945 + PHB 33 + 33 + + + + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + 553713697 + U78D2.001.WZS0B5H-P1-C2 + C2 + false + true + 240 + + + + + + + + U78D2.001.WZS0B5H-P1 + 536870946 + PHB 34 + 34 + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713698 + Empty slot + U78D2.001.WZS0B5H-P1-C3 + U78D2.001.WZS0B5H-P1-C3 + C3 + 65535 + true + true + + + 553713698 + U78D2.001.WZS0B5H-P1-C3 + C3 + false + true + 510 + + + + + + + + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713680 + Empty slot + U78D2.001.WZS0B5H-P1-C9 + U78D2.001.WZS0B5H-P1-C9 + C9 + 65535 + true + true + + + 553713680 + U78D2.001.WZS0B5H-P1-C9 + C9 + false + true + 510 + + + + + + false + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + 577D + EL58 + 5273 + EL2N + 5735 + EL58 + 5273 + EL2N + 5735 + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 61696 + 3076 + 61696 + 906 + 4319 + 3 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + 61696 + true + true + + + 553713682 + U78D2.001.WZS0B5H-P1-C10 + C10 + false + true + 80 + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + 57888 + true + true + + + 553779219 + U78D2.001.WZS0B5H-P1-C11 + C11 + true + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844756 + Empty slot + U78D2.001.WZS0B5H-P1-C12 + U78D2.001.WZS0B5H-P1-C12 + C12 + 65535 + true + true + + + 553844756 + U78D2.001.WZS0B5H-P1-C12 + C12 + false + true + 80 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + 553910293 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + false + true + 80 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975830 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C1 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + 256 + true + true + + + 553975830 + U78D2.001.WZS0B5H-P1-C49-C1 + C49-C1 + false + true + 80 + + + + + + false + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H + 10 + P9-PowerVC + AIX/Linux + 33345 + 3075 + 33345 + 1202 + 4172 + 2 + 4172 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713687 + Universal Serial Bus UHC Spec + U78D2.001.WZS0B5H-P1-T3 + U78D2.001.WZS0B5H-P1-T3 + T3 + 33345 + true + true + + + 553713687 + U78D2.001.WZS0B5H-P1-T3 + T3 + false + false + 0 + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + U78D2.001.WZS0B5H-P1-C8 + C8 + 57888 + true + true + + + 553713688 + U78D2.001.WZS0B5H-P1-C8 + C8 + true + true + 510 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713690 + Empty slot + U78D2.001.WZS0B5H-P1-C5 + U78D2.001.WZS0B5H-P1-C5 + C5 + 65535 + true + true + + + 553713690 + U78D2.001.WZS0B5H-P1-C5 + C5 + false + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779227 + Empty slot + U78D2.001.WZS0B5H-P1-C6 + U78D2.001.WZS0B5H-P1-C6 + C6 + 65535 + true + true + + + 553779227 + U78D2.001.WZS0B5H-P1-C6 + C6 + false + true + 80 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553844764 + Empty slot + U78D2.001.WZS0B5H-P1-C7 + U78D2.001.WZS0B5H-P1-C7 + C7 + 65535 + true + true + + + 553844764 + U78D2.001.WZS0B5H-P1-C7 + C7 + false + true + 80 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910301 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C1 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + 256 + true + true + + + 553910301 + U78D2.001.WZS0B5H-P1-C50-C1 + C50-C1 + false + true + 80 + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + 553975838 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + false + true + 80 + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + 58112 + true + true + + + 553713696 + U78D2.001.WZS0B5H-P1-C4 + C4 + false + true + 510 + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 1 + P924VIO1 + Virtual IO Server + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713697 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C2 + U78D2.001.WZS0B5H-P1-C2 + C2 + 58112 + true + true + + + 553713697 + U78D2.001.WZS0B5H-P1-C2 + C2 + false + true + 240 + + + + + + false + Empty slot + 0 + 0 + 0 + U78D2.001.WZS0B5H + 65535 + 65535 + 65535 + 65535 + 65535 + 255 + 65535 + 65535 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713698 + Empty slot + U78D2.001.WZS0B5H-P1-C3 + U78D2.001.WZS0B5H-P1-C3 + C3 + 65535 + true + true + + + 553713698 + U78D2.001.WZS0B5H-P1-C3 + C3 + false + true + 510 + + + 1024 + + + + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + NotConfigured + Dedicated + true + + + + + + + + 553713688 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C8 + NotConfigured + Dedicated + true + + + + + + + + + + + 1A53C6 + + + + + + + + C050760B1D10 + + + + + + 5 + 6 + 7 + 8 + 9 + 1:256,1:512,1:1024,1:2048,1:4096,1:8192 + auto,16,32,64,128,256 + 0 + 2097152 + 0 + 0 + 0 + 1132288 + 256 + none + 0 + 0 + 6 + 7 + 10 + 0 + 16384 + 2097152 + 127 + 1 + 0 + 2 + Not_In_Progress + Off + 256 + 39168 + 0 + 0 + 0 + 0 + 1132288 + 256 + none + 256 + 0 + false + 6 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 2097152 + 925696 + + + + + + 24 + 3.32 + 64 + 64 + 256 + 64 + 64 + 64 + 64 + 0 + 24 + 0 + 256 + 0.05 + 24 + 0 + 0 + 0 + 3.32 + 64 + default + POWER7 + POWER8 + POWER9_Base + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 24 + + + + + + 32 + 2 + 1 + 60 + 60 + + + + + + None + + + + + 9009 + 42A + 21F64EV + + false + 480 + 1 + 480 + 65535 + 0 + 6 + true + 172.17.0.5 + 172.17.0.5 + false + 11 + unsupported + 00090000 + operating + Server-9009-42A-SN21F64EV + 1636487916475 + true + + + + + Enabled + 16 + 8 + 0 + 0 + 16 + true + PartitionConfiguration + + + + VL930_FW930.50 (145) + + + + + Fixed_Maximum_Frequency + Fixed_Maximum_Frequency + Static + Dynamic_Favor_Performance + Fixed_Maximum_Frequency + true + + + + + 98.0% + 98.0% + 16 + 0.8% + 0.8% + 18.0% + 98.0% + false + 10.0% + 0.0% + 0.0% + 1 + 0.1% + 0.1% + 0.0% + 0.0% + 10.0% + 100.0% + 100.0% + 1024 + 100.0% + 100.0% + 100.0% + 100.0% + 100.0% + + + + + + 240 + 10 + 8.0% + 12.0% + 10 + 10 + 1.0% + 5.0% + 600 + 600 + 95.0% + 95.0% + + + false + true + false + false + false + false + false + false + false + false + + + + + + 0.5 + 4096 + + + fsp + false + + + + + 0 + + + + diff --git a/src/test/resources/2-vios.xml b/src/test/resources/2-vios.xml new file mode 100644 index 0000000..89e19b1 --- /dev/null +++ b/src/test/resources/2-vios.xml @@ -0,0 +1,3138 @@ + + 19D6097E-763E-4B64-A48A-A285B21E1D0C + VirtualIOServer + 2021-11-09T21:24:31.635+01:00 + + + + + IBM Power Systems Management Console + + -1055501072 + + + + + 19D6097E-763E-4B64-A48A-A285B21E1D0C + 1630345632370 + + + true + + 191 + POWER9_Base + On + true + false + false + false + false + false + false + normal + 21F64EV2 + VIOS 3.1.1.10 + + + + + true + true + true + true + true + true + + 2 + + + + + 400 + + + + + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553910293 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C49-C2 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + 256 + true + true + + + 553910293 + U78D2.001.WZS0B5H-P1-C49-C2 + C49-C2 + false + true + 80 + + + + + + + + + + + false + 400GB NVMe Gen3 M.2 Flash Module + ES14 + 58CE + ES14 + 58CE + U78D2.001.WZS0B5H + 2 + P924VIO2 + Virtual IO Server + 256 + 264 + 256 + 1568 + 7089 + 0 + 7089 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553975838 + 400GB NVMe Gen3 M.2 Flash Module + U78D2.001.WZS0B5H-P1-C50-C2 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + 256 + true + true + + + 553975838 + U78D2.001.WZS0B5H-P1-C50-C2 + C50-C2 + false + true + 80 + + + + + + + + + + + false + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + 577D + EL58 + 5273 + EL2N + 5735 + EL58 + 5273 + EL2N + 5735 + U78D2.001.WZS0B5H + 61696 + 3076 + 61696 + 906 + 4319 + 3 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713682 + 8 Gigabit PCI Express Dual Port Fibre Channel Adapter + U78D2.001.WZS0B5H-P1-C10 + U78D2.001.WZS0B5H-P1-C10 + C10 + + + + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + + + + + + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + + + + + + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + 553713682 + U78D2.001.WZS0B5H-P1-C10 + C10 + + + + + + + + + + + false + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + EN0H + EN0J + EN0H + EN0J + U78D2.001.WZS0B5H + 57888 + 512 + 57888 + 1039 + 4319 + 48 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553779219 + PCIe2 4-port (10Gb FCoE & 1GbE) SR&RJ45 Adapter + U78D2.001.WZS0B5H-P1-C11 + U78D2.001.WZS0B5H-P1-C11 + C11 + + + + + + + + + U78D2.001.WZS0B5H-P1-C11-T1 + + + + + + fcs2 + 1aU78D2.001.WZS0B5H-P1-C11-T1 + 100000109b64b819 + 200000109b64b819 + + + + + + U78D2.001.WZS0B5H-P1-C11-T2 + + + + + + fcs3 + 1aU78D2.001.WZS0B5H-P1-C11-T2 + 100000109b64b81a + 200000109b64b81a + + + + + 553779219 + U78D2.001.WZS0B5H-P1-C11 + C11 + + + + + + + + + + + false + PCIe3 2-Port 32Gb FC Adapter + 5787 + EN1A + EN1B + EL5U + EL5V + EN1A + EN1B + EL5U + EL5V + U78D2.001.WZS0B5H + 58112 + 3076 + 58112 + 1557 + 4319 + 1 + 4319 + 4116 + + + + + false + false + false + false + false + 65535 + false + false + false + false + false + + + + + + + 553713696 + PCIe3 2-Port 32Gb FC Adapter + U78D2.001.WZS0B5H-P1-C4 + U78D2.001.WZS0B5H-P1-C4 + C4 + + + + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + + + + + + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + + + + + + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + 553713696 + U78D2.001.WZS0B5H-P1-C4 + C4 + + + + 400 + + + + + + false + false + 4096 + 0.0 + 7 + 16384 + 4096 + 0.0 + 7 + 0 + 0 + 16384 + 4096 + 0 + 4096 + true + true + false + false + 0 + 4096 + 4096 + false + 6 + + P924VIO2 + + + + + + + + + 1 + 2 + 1 + + true + + + + + 0 + + sre idle procs always + true + sre idle procs always + + + + + 2 + 1 + 1 + 1 + + true + + + + + running + Virtual IO Server + 19D6097E-763E-4B64-A48A-A285B21E1D0C + default + 0 + 0 + + active + 10.32.64.69 + + + + + + + 28947191804160 + false + false + + false + + + + + + default_profile + true + VIOS + 0 + 0 + Normal + false + + true + true + true + true + + + + + + + + + + + + + + VMLibrary + 1 + + + false + + + + + + + + + NVMe 4K Flash Disk + U78D2.001.WZS0B5H-P1-C50-C2-L1 + NoReserve + Unknown + 01MUMwMjAxMTBmMDIyMDA5ODgwY2YwNDAwbnZtZQ== + false + 381554 + hdisk1 + active + 1C020110f022009880cf0400nvme + false + false + VU5LTk9XTg== + 01MUMwMjAxMTBmMDIyMDA5ODgwY2YwNDAwbnZtZQ== + + + + + + NVMe 4K Flash Disk + U78D2.001.WZS0B5H-P1-C49-C2-L1 + NoReserve + Unknown + 01MUMwMjAxMTBkMDE3MDA5ODgwY2YwNDAwbnZtZQ== + false + 381554 + hdisk0 + active + 1C020110d017009880cf0400nvme + false + false + VU5LTk9XTg== + 01MUMwMjAxMTBkMDE3MDA5ODgwY2YwNDAwbnZtZQ== + + + + + + + + + + + + + + + + 1 + PCIe3 100/1000 Base-TX 4-port Converged Network Adapter (df1020e214103c04) + ent2 + physicalEthernetAdpter + U78D2.001.WZS0B5H-P1-C11-T3 + U78D2.001.WZS0B5H-P1-C11-T3 + 13U78D2.001.WZS0B5H-P1-C11-T3 + + + + + en2 + Disconnected + + + + auto + ent5 + false + 1 + disabled + 8192 + true + + + + + + + + + U9009.42A.21F64EV-V2-C2 + U9009.42A.21F64EV-V2-C2 + false + true + 2 + ALL + 1A53CB15B102 + 1 + false + true + 0 + ent4 + 2 + + + + + + + en5 + Active + + 106bace54e863f119e + true + Configured + + + + + + + + + + + + + + U9009.42A.21F64EV-V2-C2 + U9009.42A.21F64EV-V2-C2 + 2 + false + true + 2 + ALL + 1A53CB15B102 + 1 + false + true + + + + 0 + ent4 + 2 + + + true + + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V5-C44 + U9009.42A.21F64EV-V5-C44 + 5 + false + true + 44 + 2 + 44 + c050760b1d100016 c050760b1d100017 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C44 + U9009.42A.21F64EV-V2-C44 + 2 + false + true + 44 + vfchost5 + 5 + 44 + 1dU9009.42A.21F64EV-V2-C44 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V5-C42 + U9009.42A.21F64EV-V5-C42 + 5 + false + true + 42 + 2 + 42 + c050760b1d100012 c050760b1d100013 + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C42 + U9009.42A.21F64EV-V2-C42 + 2 + false + true + 42 + vfchost4 + 5 + 42 + 1dU9009.42A.21F64EV-V2-C42 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V10-C88 + U9009.42A.21F64EV-V10-C88 + 10 + false + true + 88 + 2 + 88 + c050760b1d10002c c050760b1d10002d + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C88 + U9009.42A.21F64EV-V2-C88 + 2 + false + true + 88 + vfchost10 + 10 + 88 + 1dU9009.42A.21F64EV-V2-C88 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V4-C34 + U9009.42A.21F64EV-V4-C34 + 4 + false + true + 34 + 2 + 34 + c050760b1d10000e c050760b1d10000f + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C34 + U9009.42A.21F64EV-V2-C34 + 2 + false + true + 34 + vfchost3 + 4 + 34 + 1dU9009.42A.21F64EV-V2-C34 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V4-C32 + U9009.42A.21F64EV-V4-C32 + 4 + false + true + 32 + 2 + 32 + c050760b1d10000a c050760b1d10000b + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C32 + U9009.42A.21F64EV-V2-C32 + 2 + false + true + 32 + vfchost2 + 4 + 32 + 1dU9009.42A.21F64EV-V2-C32 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V18-C6 + U9009.42A.21F64EV-V18-C6 + 18 + false + true + 6 + 2 + 31 + c050760b1d100226 c050760b1d100227 + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C31 + U9009.42A.21F64EV-V2-C31 + 2 + false + true + 31 + vfchost33 + 18 + 6 + 1dU9009.42A.21F64EV-V2-C31 + fcs5 + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V21-C5 + U9009.42A.21F64EV-V21-C5 + 21 + false + true + 5 + 2 + 30 + c050760b1d1000da c050760b1d1000db + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C30 + U9009.42A.21F64EV-V2-C30 + 2 + false + true + 30 + vfchost32 + 21 + 5 + 1dU9009.42A.21F64EV-V2-C30 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V21-C3 + U9009.42A.21F64EV-V21-C3 + 21 + false + true + 3 + 2 + 29 + c050760b1d1000d6 c050760b1d1000d7 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C29 + U9009.42A.21F64EV-V2-C29 + 2 + false + true + 29 + vfchost31 + 21 + 3 + 1dU9009.42A.21F64EV-V2-C29 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V18-C4 + U9009.42A.21F64EV-V18-C4 + 18 + false + true + 4 + 2 + 28 + c050760b1d100222 c050760b1d100223 + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C28 + U9009.42A.21F64EV-V2-C28 + 2 + false + true + 28 + vfchost30 + 18 + 4 + 1dU9009.42A.21F64EV-V2-C28 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V8-C74 + U9009.42A.21F64EV-V8-C74 + 8 + false + true + 74 + 2 + 74 + c050760b1d100206 c050760b1d100207 + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C74 + U9009.42A.21F64EV-V2-C74 + 2 + false + true + 74 + vfchost25 + 8 + 74 + 1dU9009.42A.21F64EV-V2-C74 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V19-C6 + U9009.42A.21F64EV-V19-C6 + 19 + false + true + 6 + 2 + 26 + c050760b1d1000ec c050760b1d1000ed + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C26 + U9009.42A.21F64EV-V2-C26 + 2 + false + true + 26 + vfchost28 + 19 + 6 + 1dU9009.42A.21F64EV-V2-C26 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V19-C4 + U9009.42A.21F64EV-V19-C4 + 19 + false + true + 4 + 2 + 25 + c050760b1d1000e8 c050760b1d1000e9 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C25 + U9009.42A.21F64EV-V2-C25 + 2 + false + true + 25 + vfchost27 + 19 + 4 + 1dU9009.42A.21F64EV-V2-C25 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V8-C72 + U9009.42A.21F64EV-V8-C72 + 8 + false + true + 72 + 2 + 72 + c050760b1d100026 c050760b1d100027 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C72 + U9009.42A.21F64EV-V2-C72 + 2 + false + true + 72 + vfchost9 + 8 + 72 + 1dU9009.42A.21F64EV-V2-C72 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V3-C24 + U9009.42A.21F64EV-V3-C24 + 3 + false + true + 24 + 2 + 24 + c050760b1d100006 c050760b1d100007 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C24 + U9009.42A.21F64EV-V2-C24 + 2 + false + true + 24 + vfchost1 + 3 + 24 + 1dU9009.42A.21F64EV-V2-C24 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V3-C22 + U9009.42A.21F64EV-V3-C22 + 3 + false + true + 22 + 2 + 22 + c050760b1d100002 c050760b1d100003 + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C22 + U9009.42A.21F64EV-V2-C22 + 2 + false + true + 22 + vfchost0 + 3 + 22 + 1dU9009.42A.21F64EV-V2-C22 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V16-C6 + U9009.42A.21F64EV-V16-C6 + 16 + false + true + 6 + 2 + 21 + c050760b1d1000b4 c050760b1d1000b5 + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C21 + U9009.42A.21F64EV-V2-C21 + 2 + false + true + 21 + vfchost22 + 16 + 6 + 1dU9009.42A.21F64EV-V2-C21 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V9-C4 + U9009.42A.21F64EV-V9-C4 + 9 + false + true + 4 + 2 + 20 + c050760b1d100212 c050760b1d100213 + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C20 + U9009.42A.21F64EV-V2-C20 + 2 + false + true + 20 + vfchost29 + 9 + 4 + 1dU9009.42A.21F64EV-V2-C20 + fcs5 + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V9-C2 + U9009.42A.21F64EV-V9-C2 + 9 + false + true + 2 + 2 + 19 + c050760b1d100210 c050760b1d100211 + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C19 + U9009.42A.21F64EV-V2-C19 + 2 + false + true + 19 + vfchost26 + 9 + 2 + 1dU9009.42A.21F64EV-V2-C19 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V15-C6 + U9009.42A.21F64EV-V15-C6 + 15 + false + true + 6 + 2 + 18 + c050760b1d10020e c050760b1d10020f + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C18 + U9009.42A.21F64EV-V2-C18 + 2 + false + true + 18 + vfchost20 + 15 + 6 + 1dU9009.42A.21F64EV-V2-C18 + fcs5 + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V17-C5 + U9009.42A.21F64EV-V17-C5 + 17 + false + true + 5 + 2 + 17 + c050760b1d100202 c050760b1d100203 + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C17 + U9009.42A.21F64EV-V2-C17 + 2 + false + true + 17 + vfchost24 + 17 + 5 + 1dU9009.42A.21F64EV-V2-C17 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V17-C2 + U9009.42A.21F64EV-V17-C2 + 17 + false + true + 2 + 2 + 16 + c050760b1d1001fe c050760b1d1001ff + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C16 + U9009.42A.21F64EV-V2-C16 + 2 + false + true + 16 + vfchost23 + 17 + 2 + 1dU9009.42A.21F64EV-V2-C16 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V7-C62 + U9009.42A.21F64EV-V7-C62 + 7 + false + true + 62 + 2 + 62 + c050760b1d100022 c050760b1d100023 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C62 + U9009.42A.21F64EV-V2-C62 + 2 + false + true + 62 + vfchost8 + 7 + 62 + 1dU9009.42A.21F64EV-V2-C62 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V16-C4 + U9009.42A.21F64EV-V16-C4 + 16 + false + true + 4 + 2 + 15 + c050760b1d1000b0 c050760b1d1000b1 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C15 + U9009.42A.21F64EV-V2-C15 + 2 + false + true + 15 + vfchost21 + 16 + 4 + 1dU9009.42A.21F64EV-V2-C15 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V15-C4 + U9009.42A.21F64EV-V15-C4 + 15 + false + true + 4 + 2 + 14 + c050760b1d10020a c050760b1d10020b + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C14 + U9009.42A.21F64EV-V2-C14 + 2 + false + true + 14 + vfchost19 + 15 + 4 + 1dU9009.42A.21F64EV-V2-C14 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V13-C5 + U9009.42A.21F64EV-V13-C5 + 13 + false + true + 5 + 2 + 9 + c050760b1d10005a c050760b1d10005b + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C9 + U9009.42A.21F64EV-V2-C9 + 2 + false + true + 9 + vfchost16 + 13 + 5 + 1dU9009.42A.21F64EV-V2-C9 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V13-C2 + U9009.42A.21F64EV-V13-C2 + 13 + false + true + 2 + 2 + 8 + c050760b1d100056 c050760b1d100057 + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C8 + U9009.42A.21F64EV-V2-C8 + 2 + false + true + 8 + vfchost15 + 13 + 2 + 1dU9009.42A.21F64EV-V2-C8 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V6-C54 + U9009.42A.21F64EV-V6-C54 + 6 + false + true + 54 + 2 + 54 + c050760b1d10001e c050760b1d10001f + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C54 + U9009.42A.21F64EV-V2-C54 + 2 + false + true + 54 + vfchost7 + 6 + 54 + 1dU9009.42A.21F64EV-V2-C54 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V6-C52 + U9009.42A.21F64EV-V6-C52 + 6 + false + true + 52 + 2 + 52 + c050760b1d10001a c050760b1d10001b + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C52 + U9009.42A.21F64EV-V2-C52 + 2 + false + true + 52 + vfchost6 + 6 + 52 + 1dU9009.42A.21F64EV-V2-C52 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V11-C5 + U9009.42A.21F64EV-V11-C5 + 11 + false + true + 5 + 2 + 4 + c050760b1d100032 c050760b1d100033 + + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C4 + U9009.42A.21F64EV-V2-C4 + 2 + false + true + 4 + vfchost12 + 11 + 5 + 1dU9009.42A.21F64EV-V2-C4 + fcs0 + + + + + U78D2.001.WZS0B5H-P1-C4-T1 + fcs0 + 1aU78D2.001.WZS0B5H-P1-C4-T1 + 100000109b7db969 + 200000109b7db969 + 54 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V11-C2 + U9009.42A.21F64EV-V11-C2 + 11 + false + true + 2 + 2 + 3 + c050760b1d10002e c050760b1d10002f + + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C3 + U9009.42A.21F64EV-V2-C3 + 2 + false + true + 3 + vfchost11 + 11 + 2 + 1dU9009.42A.21F64EV-V2-C3 + fcs1 + + + + + U78D2.001.WZS0B5H-P1-C4-T2 + fcs1 + 1aU78D2.001.WZS0B5H-P1-C4-T2 + 100000109b7db96a + 200000109b7db96a + 51 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V12-C3 + U9009.42A.21F64EV-V12-C3 + 12 + false + true + 3 + 2 + 5 + c050760b1d100228 c050760b1d100229 + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C5 + U9009.42A.21F64EV-V2-C5 + 2 + false + true + 5 + vfchost13 + 12 + 3 + 1dU9009.42A.21F64EV-V2-C5 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V12-C5 + U9009.42A.21F64EV-V12-C5 + 12 + false + true + 5 + 2 + 6 + c050760b1d10022c c050760b1d10022d + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C6 + U9009.42A.21F64EV-V2-C6 + 2 + false + true + 6 + vfchost14 + 12 + 5 + 1dU9009.42A.21F64EV-V2-C6 + fcs5 + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V14-C4 + U9009.42A.21F64EV-V14-C4 + 14 + false + false + 4 + 2 + 10 + c050760b1d100232 c050760b1d100233 + + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C10 + U9009.42A.21F64EV-V2-C10 + 2 + false + true + 10 + vfchost17 + 14 + 4 + 1dU9009.42A.21F64EV-V2-C10 + fcs4 + + + + + U78D2.001.WZS0B5H-P1-C10-T1 + fcs4 + 1aU78D2.001.WZS0B5H-P1-C10-T1 + 10000090fa0480c6 + 20000120fa0480c6 + 59 + 64 + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V14-C6 + U9009.42A.21F64EV-V14-C6 + 14 + false + false + 6 + 2 + 11 + c050760b1d100236 c050760b1d100237 + + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + Server + U9009.42A.21F64EV-V2-C11 + U9009.42A.21F64EV-V2-C11 + 2 + false + true + 11 + vfchost18 + 14 + 6 + 1dU9009.42A.21F64EV-V2-C11 + fcs5 + + + + + U78D2.001.WZS0B5H-P1-C10-T2 + fcs5 + 1aU78D2.001.WZS0B5H-P1-C10-T2 + 10000090fa0480c7 + 20000120fa0480c7 + 60 + 64 + + + + + + + + + + + + + + + + + + Client + U9009.42A.21F64EV-V16-C3 + U9009.42A.21F64EV-V16-C3 + 16 + false + true + 3 + 2 + 12 + U9009.42A.21F64EV-V2-C12 + + + + + + Server + U9009.42A.21F64EV-V2-C12 + U9009.42A.21F64EV-V2-C12 + 2 + false + true + 12 + vhost2 + 16 + 3 + U9009.42A.21F64EV-V16-C3 + 1eU9009.42A.21F64EV-V2-C12 + + + + + + + + + + + + Client + U9009.42A.21F64EV-V19-C2 + U9009.42A.21F64EV-V19-C2 + 19 + false + true + 2 + 2 + 23 + U9009.42A.21F64EV-V2-C23 + + + + + + Server + U9009.42A.21F64EV-V2-C23 + U9009.42A.21F64EV-V2-C23 + 2 + false + true + 23 + vhost3 + 19 + 2 + U9009.42A.21F64EV-V19-C2 + 1eU9009.42A.21F64EV-V2-C23 + + + + + + + + + + + + Client + U9009.42A.21F64EV-V15-C2 + U9009.42A.21F64EV-V15-C2 + 15 + false + true + 2 + 2 + 13 + U9009.42A.21F64EV-V2-C13 + + + + + + Server + U9009.42A.21F64EV-V2-C13 + U9009.42A.21F64EV-V2-C13 + 2 + false + true + 13 + vhost1 + 15 + 2 + U9009.42A.21F64EV-V15-C2 + 1eU9009.42A.21F64EV-V2-C13 + + + + + + + + + + + + Client + U9009.42A.21F64EV-V18-C2 + U9009.42A.21F64EV-V18-C2 + 18 + false + true + 2 + 2 + 27 + U9009.42A.21F64EV-V2-C27 + + + + + + Server + U9009.42A.21F64EV-V2-C27 + U9009.42A.21F64EV-V2-C27 + 2 + false + true + 27 + vhost4 + 18 + 2 + U9009.42A.21F64EV-V18-C2 + 1eU9009.42A.21F64EV-V2-C27 + + + + + + + + + + + + + 1 + PCIe3 100/1000 Base-TX 4-port Converged Network Adapter (df1020e214103c04) + ent3 + physicalEthernetAdpter + U78D2.001.WZS0B5H-P1-C11-T4 + U78D2.001.WZS0B5H-P1-C11-T4 + 13U78D2.001.WZS0B5H-P1-C11-T4 + + + + + + + + 1 + PCIe3 10GbE SFP+ SR 4-port Converged Network Adapter (df1020e214100f04) + ent1 + physicalEthernetAdpter + U78D2.001.WZS0B5H-P1-C11-T2 + U78D2.001.WZS0B5H-P1-C11-T2 + 13U78D2.001.WZS0B5H-P1-C11-T2 + + + + + + + + 1 + PCIe3 10GbE SFP+ SR 4-port Converged Network Adapter (df1020e214100f04) + ent0 + physicalEthernetAdpter + U78D2.001.WZS0B5H-P1-C11-T1 + U78D2.001.WZS0B5H-P1-C11-T1 + 13U78D2.001.WZS0B5H-P1-C11-T1 + + + + + + + + + + + + + 1 + PCIe3 100/1000 Base-TX 4-port Converged Network Adapter (df1020e214103c04) + ent3 + U78D2.001.WZS0B5H-P1-C11-T4 + + + + + en3 + 10.32.64.69 + 255.255.255.0 + Active + + + + + + + + + 1 + PCIe3 10GbE SFP+ SR 4-port Converged Network Adapter (df1020e214100f04) + ent1 + U78D2.001.WZS0B5H-P1-C11-T2 + + + + + en1 + Inactive + + + + + + + + + 1 + PCIe3 10GbE SFP+ SR 4-port Converged Network Adapter (df1020e214100f04) + ent0 + U78D2.001.WZS0B5H-P1-C11-T1 + + + + + en0 + Inactive + + + + + + + + + + + + + + true + true + + + + diff --git a/src/test/resources/3-logical-partition-perf-data.json b/src/test/resources/3-logical-partition-perf-data.json new file mode 100644 index 0000000..b26fbaa --- /dev/null +++ b/src/test/resources/3-logical-partition-perf-data.json @@ -0,0 +1,274 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2020-08-10T21:06:30+0200", + "endTimeStamp": "2020-08-10T21:06: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-10T21:06: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": 13, + "uuid": "6B7D14D3-BBD2-475B-8284-70FADBFC37FB", + "name": "ubuntu-bionic-a02af293-00000006", + "state": "Running", + "type": "AIX/Linux", + "osType": "Linux", + "affinityScore": 100, + "memory": { + "logicalMem": [ + 8192.000 + ], + "backedPhysicalMem": [ + 8192.000 + ] + }, + "processor": { + "poolId": 0, + "weight": 128, + "mode": "uncap", + "maxVirtualProcessors": [ + 2.000 + ], + "currentVirtualProcessors": [ + 2.000 + ], + "maxProcUnits": [ + 2.000 + ], + "entitledProcUnits": [ + 1.000 + ], + "utilizedProcUnits": [ + 0.001 + ], + "utilizedCappedProcUnits": [ + 0.001 + ], + "utilizedUncappedProcUnits": [ + 0.000 + ], + "idleProcUnits": [ + 0.001 + ], + "donatedProcUnits": [ + 0.000 + ], + "timeSpentWaitingForDispatch": [ + 0.000 + ], + "timePerInstructionExecution": [ + 0.000 + ] + }, + "network": { + "virtualEthernetAdapters": [ + { + "physicalLocation": "U9009.42A.21F64EV-V13-C32", + "vlanId": 1, + "vswitchId": 0, + "isPortVlanId": true, + "viosId": 1, + "sharedEthernetAdapterId": "ent5", + "receivedPackets": [ + 3.867 + ], + "sentPackets": [ + 0.233 + ], + "droppedPackets": [ + 0.000 + ], + "sentBytes": [ + 35.667 + ], + "receivedBytes": [ + 276.467 + ], + "receivedPhysicalPackets": [ + 3.867 + ], + "sentPhysicalPackets": [ + 0.233 + ], + "droppedPhysicalPackets": [ + 0.000 + ], + "sentPhysicalBytes": [ + 35.667 + ], + "receivedPhysicalBytes": [ + 276.467 + ], + "transferredBytes": [ + 312.134 + ], + "transferredPhysicalBytes": [ + 312.134 + ] + } + ] + }, + "storage": { + "genericVirtualAdapters": [ + { + "id": "vhost7", + "type": "virtual", + "viosId": 1, + "physicalLocation": "U9009.42A.21F64EV-V13-C3", + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.000 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 0.000 + ], + "transmittedBytes": [ + null + ] + } + ], + "virtualFiberChannelAdapters": [ + { + "wwpn": "c050760b1d10005c", + "wwpn2": "c050760b1d10005d", + "physicalLocation": "U9009.42A.21F64EV-V13-C6", + "physicalPortWWPN": "100000109b89aca9", + "viosId": 1, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6690.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d100056", + "wwpn2": "c050760b1d100057", + "physicalLocation": "U9009.42A.21F64EV-V13-C2", + "physicalPortWWPN": "100000109b7db96a", + "viosId": 2, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 546.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d100058", + "wwpn2": "c050760b1d100059", + "physicalLocation": "U9009.42A.21F64EV-V13-C4", + "physicalPortWWPN": "100000109b89aca8", + "viosId": 1, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 6690.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + }, + { + "wwpn": "c050760b1d10005a", + "wwpn2": "c050760b1d10005b", + "physicalLocation": "U9009.42A.21F64EV-V13-C5", + "physicalPortWWPN": "100000109b7db969", + "viosId": 2, + "numOfReads": [ + 0.000 + ], + "numOfWrites": [ + 0.100 + ], + "readBytes": [ + 0.000 + ], + "writeBytes": [ + 546.133 + ], + "runningSpeed": [ + 8.000 + ], + "transmittedBytes": [ + 0.000 + ] + } + ] + } + } + ] + } + ] + } +} diff --git a/src/test/resources/3-lpar.xml b/src/test/resources/3-lpar.xml new file mode 100644 index 0000000..9170ab5 --- /dev/null +++ b/src/test/resources/3-lpar.xml @@ -0,0 +1,200 @@ + + 72A9CD86-312A-4A61-B9A3-2D5A11B373E5 + LogicalPartition + 2021-11-09T21:18:07.591+01:00 + + + + + IBM Power Systems Management Console + + -1911778802 + + + + + 72A9CD86-312A-4A61-B9A3-2D5A11B373E5 + 1611332385932 + + + false + + 127 + POWER9_Base + On + true + true + false + false + false + false + false + normal + 21F64EVB + Linux/Red Hat Enterprise Linux 4.18.0-240.10.1.el8_3.ppc8.3 (Ootpa) 8.3 (Ootpa) + + + + + true + true + false + true + true + true + + 11 + + + + + 64 + + + + + + 64 + + + + + + false + false + 0 + 4096 + 0.0 + 7 + 0 + 6144 + 0 + 4096 + 0.0 + 7 + 0 + 0 + 6144 + 4096 + 0 + 4096 + true + true + false + false + 0 + 4096 + 4096 + false + 6 + + rhel8-ocp-helper + + + + + false + + + + + 0.93 + 2 + 4 + 4 + 0.1 + 1 + 0 + 100 + + uncapped + false + uncapped + false + + + + + 2 + 4 + 0.1 + 0.93 + 0 + 100 + 1 + 4 + 0.93 + 100 + + + + + + running + AIX/Linux + 72A9CD86-312A-4A61-B9A3-2D5A11B373E5 + default + + 0 + 0 + + active + 10.32.64.57 + + + + + + + + + + 28947267402240 + false + false + Linux ppc64le + false + + + + + + default_profile + false + Linux + 0 + 0 + Normal + false + + Update_Failed + Thu Feb 11 08:22:10 CET 2021 + false + false + false + false + false + Not_Migrating + Invalid + + + + + + + + + + + + + + + + /vdevice/vfc-client@30000002/disk@500507680120bcc7 + IBM-2145-60050768018185f900000000000004ea + IBM-2145-60050768018185f900000000000004ea + + + + diff --git a/src/test/resources/4-managed-system-emergy-perf-data.json b/src/test/resources/4-managed-system-emergy-perf-data.json new file mode 100644 index 0000000..c19cece --- /dev/null +++ b/src/test/resources/4-managed-system-emergy-perf-data.json @@ -0,0 +1,104 @@ +{ + "systemUtil": { + "utilInfo": { + "version": "1.3.0", + "metricType": "Processed", + "frequency": 30, + "startTimeStamp": "2022-11-22T17:17:30+0100", + "endTimeStamp": "2022-11-22T17:17:30+0100", + "mtms": "9009-42A*21F64EV", + "name": "Server-9009-42A-SN21F64EV", + "uuid": "b597e4da-2aab-3f52-8616-341d62153559", + "metricArrayOrder": [ + "AVG" + ] + }, + "utilSamples": [ + { + "sampleType": "ManagedSystem", + "sampleInfo": { + "timeStamp": "2022-11-22T17:17:30+0100", + "status": 0 + }, + "energyUtil": { + "powerUtil": { + "powerReading": [ + 407.000 + ] + }, + "thermalUtil": { + "inletTemperatures": [ + { + "entityId": "Inlet air temperature(40h)", + "entityInstance": "1", + "temperatureReading": [ + 29.000 + ] + } + ], + "cpuTemperatures": [ + { + "entityId": "CPU temperature sensors(41h)", + "entityInstance": "2", + "temperatureReading": [ + 40.000 + ] + }, + { + "entityId": "CPU temperature sensors(41h)", + "entityInstance": "1", + "temperatureReading": [ + 38.000 + ] + } + ], + "baseboardTemperatures": [ + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "1", + "temperatureReading": [ + 43.000 + ] + }, + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "2", + "temperatureReading": [ + 44.000 + ] + }, + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "3", + "temperatureReading": [ + 44.000 + ] + }, + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "4", + "temperatureReading": [ + 41.000 + ] + }, + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "5", + "temperatureReading": [ + 41.000 + ] + }, + { + "entityId": "Baseboard temperature sensors(42h)", + "entityInstance": "6", + "temperatureReading": [ + 42.000 + ] + } + ] + } + } + } + ] + } +} diff --git a/src/test/resources/4-managed-system-energy.xml b/src/test/resources/4-managed-system-energy.xml new file mode 100644 index 0000000..8b90dd4 --- /dev/null +++ b/src/test/resources/4-managed-system-energy.xml @@ -0,0 +1,19 @@ + + b597e4da-2aab-3f52-8616-341d62153559 + 2022-11-22T17:17:30.000+01:00 + ProcessedMetrics + ManagedSystem b597e4da-2aab-3f52-8616-341d62153559 + + + + 2cc84aa2-a774-40bb-b710-9b6612a8ae90 + 2022-11-22T17:17:30.000+01:00 + EnergyMetrics_ManagedSystem_b597e4da-2aab-3f52-8616-341d62153559_20221122T171730+0100_20221122T171730+0100_30.json + 2022-11-22T17:17:30.000+01:00 + + + IBM Power Systems Management Console + + + + diff --git a/src/test/resources/hmc-logon-request.xml b/src/test/resources/hmc-logon-request.xml new file mode 100644 index 0000000..b06b843 --- /dev/null +++ b/src/test/resources/hmc-logon-request.xml @@ -0,0 +1,5 @@ + + + hmci + hmcihmci + diff --git a/src/test/resources/hmc-logon-response.xml b/src/test/resources/hmc-logon-response.xml new file mode 100644 index 0000000..f065603 --- /dev/null +++ b/src/test/resources/hmc-logon-response.xml @@ -0,0 +1,7 @@ + + + + + + tKVhm4YD0bS0qjaYuXI8b2ZbOvh8MlGV1Inivvwd7L3VTUyP0J3j6pLcaaW-Ek3xPWLuF2-kLZDabjUvukWyyM69ytjz6LGZRK4VI_qsz5KEfwg6weIp6olXId-S6ioNP_CcKfjwkL6HZMMWyLSmMrSA0cz7QVkvoUeBB6mAFK_LjI1SBfCXupnVEsKdFpH9FdSS4_s-LrDend__MC1Xqm9_7xq-GN_J5tiE1zwSXvY= + diff --git a/src/test/resources/hmci.toml b/src/test/resources/hmci.toml index 289202b..ada3043 100644 --- a/src/test/resources/hmci.toml +++ b/src/test/resources/hmci.toml @@ -1,11 +1,5 @@ # HMCi Configuration -# How often to query HMC's for data - in seconds -hmci.refresh = 30 - -# Rescan HMC's for new systems and partitions - every x refresh -hmci.rescan = 60 - # InfluxDB to save metrics [influx] url = "http://localhost:8086" @@ -18,7 +12,9 @@ database = "hmci" url = "https://10.10.10.10:12443" username = "hmci" password = "hmcihmci" -unsafe = true # Ignore SSL cert. errors +refresh = 29 +discover = 59 +trust = true # Ignore SSL cert. errors energy = false # Do not try to collect energy metrics excludeSystems = [ 'notThisSys', 'andNotThisSys' ] includeSystems = [ 'onlyThisSys', 'andOnlyThisSys' ] @@ -26,11 +22,18 @@ excludePartitions = [ 'notThisPartition' ] includePartitions = [ 'onlyThisPartition' ] +# SVC +[svc] +name = "site2" +url = "https://10.32.64.182:7443" +username = "superuser" +password = "Password" + # Example -#[hmc.site2] -#url = "https://10.10.20.20:12443" -#username = "viewer" -#password = "someSecret" -#unsafe = false -#energy = true -#trace = "/tmp/pcm-files" +[hmc.site2] +url = "https://10.10.20.20:12443" +username = "viewer" +password = "someSecret" +unsafe = false +energy = true +trace = "/tmp/pcm-files"