Fix error in sriov type being null.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Mark Nellemann 2023-01-05 14:28:12 +01:00
parent 985b9100c3
commit 5952a21714
36 changed files with 122 additions and 32 deletions

View file

@ -2,11 +2,14 @@
All notable changes to this project will be documented in this file.
## [1.4.1] - 2011-12-15
## [1.4.2] - 2023-01-05
- Fix error in sriov type being null.
## [1.4.1] - 2022-12-15
- Retrieve multiple PCM samples and keep track of processing.
- Rename VIOS metric 'vFC' (storage adapter) to 'virtual'.
## [1.4.0] - 2011-12-01
## [1.4.0] - 2022-12-01
- Rewrite of toml+xml+json de-serialization code (uses jackson now).
- Changes to configuration file format - please look at [doc/hmci.toml](doc/hmci.toml) as example.
- Logging (write to file) JSON output from HMC is currently not possible.
@ -28,6 +31,7 @@ All notable changes to this project will be documented in this file.
## [1.2.7] - 2022-02-24
- Options to include/exclude Managed Systems and/or Logical Partitions.
[1.4.2]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.4.2%0Dv1.4.1
[1.4.1]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.4.1%0Dv1.4.0
[1.4.0]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.4.0%0Dv1.3.3
[1.3.3]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.3%0Dv1.3.0

View file

@ -1,3 +1,3 @@
projectId = hmci
projectGroup = biz.nellemann.hmci
projectVersion = 1.4.1
projectVersion = 1.4.2

View file

@ -107,7 +107,11 @@ public final class InfluxClient {
public void write(List<Measurement> measurements, String name) {
log.debug("write() - measurement: {} {}", name, measurements.size());
processMeasurementMap(measurements, name).forEach( (point) -> { influxDB.write(point); });
if(!measurements.isEmpty()) {
processMeasurementMap(measurements, name).forEach((point) -> {
influxDB.write(point);
});
}
}

View file

@ -151,6 +151,7 @@ class LogicalPartition extends Resource {
// LPAR Details
List<Measurement> getDetails(int sample) throws NullPointerException {
log.debug("getDetails()");
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<>();
@ -175,7 +176,7 @@ class LogicalPartition extends Resource {
// LPAR Memory
List<Measurement> getMemoryMetrics(int sample) throws NullPointerException {
log.debug("getMemoryMetrics()");
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<>();
@ -197,7 +198,7 @@ class LogicalPartition extends Resource {
// LPAR Processor
List<Measurement> getProcessorMetrics(int sample) throws NullPointerException {
log.debug("getProcessorMetrics()");
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
@ -231,7 +232,7 @@ class LogicalPartition extends Resource {
// LPAR Network - Virtual
List<Measurement> getVirtualEthernetAdapterMetrics(int sample) throws NullPointerException {
log.debug("getVirtualEthernetAdapterMetrics()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).lparsUtil.network.virtualEthernetAdapters.forEach(adapter -> {
@ -272,7 +273,7 @@ class LogicalPartition extends Resource {
// LPAR Storage - Virtual Generic
List<Measurement> getVirtualGenericAdapterMetrics(int sample) throws NullPointerException {
log.debug("getVirtualGenericAdapterMetrics()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).lparsUtil.storage.genericVirtualAdapters.forEach(adapter -> {
@ -303,7 +304,7 @@ class LogicalPartition extends Resource {
// LPAR Storage - Virtual FC
List<Measurement> getVirtualFibreChannelAdapterMetrics(int sample) throws NullPointerException {
log.debug("getVirtualFibreChannelAdapterMetrics()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).lparsUtil.storage.virtualFiberChannelAdapters.forEach(adapter -> {
@ -334,7 +335,7 @@ class LogicalPartition extends Resource {
// LPAR Network - SR-IOV Logical Ports
List<Measurement> getSriovLogicalPorts(int sample) throws NullPointerException {
log.debug("getSriovLogicalPorts()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).lparsUtil.network.sriovLogicalPorts.forEach(port -> {
@ -345,7 +346,6 @@ class LogicalPartition extends Resource {
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);

View file

@ -291,7 +291,7 @@ class ManagedSystem extends Resource {
// System details
List<Measurement> getDetails(int sample) throws NullPointerException {
log.debug("getDetails()");
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new TreeMap<>();
Map<String, Object> fieldsMap = new TreeMap<>();
@ -321,7 +321,7 @@ class ManagedSystem extends Resource {
// System Memory
List<Measurement> getMemoryMetrics(int sample) throws NullPointerException {
log.debug("getMemoryMetrics()");
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>();
@ -344,7 +344,7 @@ class ManagedSystem extends Resource {
// System Processor
List<Measurement> getProcessorMetrics(int sample) throws NullPointerException {
log.debug("getProcessorMetrics()");
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
@ -365,7 +365,7 @@ class ManagedSystem extends Resource {
// Sytem Shared ProcessorPools
List<Measurement> getSharedProcessorPools(int sample) throws NullPointerException {
log.debug("getSharedProcessorPools()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> {
HashMap<String, String> tagsMap = new HashMap<>();
@ -392,7 +392,7 @@ class ManagedSystem extends Resource {
// System Physical ProcessorPool
List<Measurement> getPhysicalProcessorPool(int sample) throws NullPointerException {
log.debug("getPhysicalProcessorPool()");
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<>();
HashMap<String, Object> fieldsMap = new HashMap<>();
@ -420,7 +420,7 @@ class ManagedSystem extends Resource {
// VIO Details
List<Measurement> getVioDetails(int sample) throws NullPointerException {
log.debug("getVioDetails()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
@ -446,7 +446,7 @@ class ManagedSystem extends Resource {
// VIO Memory
List<Measurement> getVioMemoryMetrics(int sample) throws NullPointerException {
log.debug("getVioMemoryMetrics()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
@ -474,7 +474,7 @@ class ManagedSystem extends Resource {
// VIO Processor
List<Measurement> getVioProcessorMetrics(int sample) throws NullPointerException {
log.debug("getVioProcessorMetrics()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
@ -509,7 +509,7 @@ class ManagedSystem extends Resource {
// VIOs - Network
List<Measurement> getVioNetworkLpars(int sample) throws NullPointerException {
log.debug("getVioNetworkLpars()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
@ -532,7 +532,7 @@ class ManagedSystem extends Resource {
// VIO Network - Shared
List<Measurement> getVioNetworkSharedAdapters(int sample) throws NullPointerException {
log.debug("getVioNetworkSharedAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
vio.network.sharedAdapters.forEach(adapter -> {
@ -565,7 +565,7 @@ class ManagedSystem extends Resource {
// VIO Network - Virtual
List<Measurement> getVioNetworkVirtualAdapters(int sample) throws NullPointerException {
log.debug("getVioNetworkVirtualAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach( vio -> {
vio.network.virtualEthernetAdapters.forEach( adapter -> {
@ -605,7 +605,7 @@ class ManagedSystem extends Resource {
// VIO Network - Generic
List<Measurement> getVioNetworkGenericAdapters(int sample) throws NullPointerException {
log.debug("getVioNetworkGenericAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach( vio -> {
vio.network.genericAdapters.forEach( adapter -> {
@ -637,7 +637,7 @@ class ManagedSystem extends Resource {
// VIOs - Storage
List<Measurement> getVioStorageLpars(int sample) throws NullPointerException {
log.debug("getVioStorageLpars()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach(vio -> {
@ -660,7 +660,7 @@ class ManagedSystem extends Resource {
// VIO Storage FC
List<Measurement> getVioStorageFiberChannelAdapters(int sample) throws NullPointerException {
log.debug("getVioStorageFiberChannelAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach( vio -> {
log.trace("getVioStorageFiberChannelAdapters() - VIO: " + vio.name);
@ -694,8 +694,9 @@ class ManagedSystem extends Resource {
// VIO Storage - Physical
List<Measurement> getVioStoragePhysicalAdapters(int sample) throws NullPointerException {
log.debug("getVioStoragePhysicalAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach( vio -> {
log.trace("getVioStoragePhysicalAdapters() - VIO: " + vio.name);
@ -728,7 +729,7 @@ class ManagedSystem extends Resource {
// VIO Storage - Virtual
List<Measurement> getVioStorageVirtualAdapters(int sample) throws NullPointerException {
log.debug("getVioStorageVirtualAdapters()");
List<Measurement> list = new ArrayList<>();
metric.getSample(sample).viosUtil.forEach( (vio) -> {
vio.storage.genericVirtualAdapters.forEach( (adapter) -> {

View file

@ -114,7 +114,7 @@ public abstract class Resource {
processed++;
sampleHistory.add(timestamp); // Add to processed history
} catch (NullPointerException e) {
log.warn("process() - error: {}", e.getMessage());
log.warn("process() - error", e);
}
}

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class EnergyUtil {
public PowerUtil powerUtil = new PowerUtil();

View file

@ -1,10 +1,13 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Storage adapter
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class FiberChannelAdapter {
public String id;

View file

@ -1,6 +1,9 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class GenericAdapter {
public String id;

View file

@ -1,10 +1,13 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class GenericPhysicalAdapters {
public String id;
public String type;
public String type = "";
public String physicalLocation;
public double numOfReads;
public double numOfWrites;

View file

@ -1,12 +1,13 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Storage adapter
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class GenericVirtualAdapter {
public String id = "";

View file

@ -1,6 +1,9 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class LparProcessor {
public Integer poolId = 0;

View file

@ -1,9 +1,12 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class Network {
public List<String> clientLpars = new ArrayList<>();

View file

@ -1,6 +1,9 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class PhysicalProcessorPool {
public double assignedProcUnits = 0.0;

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class PowerUtil {
public Number powerReading = 0.0;

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProcessedMetrics {
public SystemUtil systemUtil;

View file

@ -1,7 +1,10 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SRIOVAdapter {
public String drcIndex = "";

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class SRIOVLogicalPort {
public String drcIndex;

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SRIOVPhysicalPort {
public String id;

View file

@ -1,10 +1,12 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SampleInfo {
@JsonProperty("timeStamp")

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ServerMemory {
public double totalMem = 0.0;

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ServerProcessor {
public Double totalProcUnits = 0.0;

View file

@ -1,9 +1,12 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ServerUtil {
public final ServerProcessor processor = new ServerProcessor();

View file

@ -1,12 +1,15 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
/**
* Network adapter
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SharedAdapter {
public String id;

View file

@ -1,6 +1,9 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SharedProcessorPool {
public int id;

View file

@ -1,9 +1,12 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class Storage {
public List<String> clientLpars = new ArrayList<>();

View file

@ -1,9 +1,11 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SystemFirmware {
@JsonUnwrapped

View file

@ -1,9 +1,11 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class SystemUtil {
@JsonProperty("utilInfo")

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class Temperature {
public String entityId = "";

View file

@ -1,8 +1,11 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ThermalUtil {
public List<Temperature> inletTemperatures = new ArrayList<>();

View file

@ -2,7 +2,7 @@ package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties({ "metricArrayOrder" })
@JsonIgnoreProperties(ignoreUnknown = true)
public final class UtilInfo {
public String version = "";

View file

@ -1,12 +1,13 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class UtilSample {
public String sampleType = "";

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ViosMemory {
public double assignedMem;
public double utilizedMem;

View file

@ -1,5 +1,8 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class ViosUtil {
public int id;

View file

@ -1,10 +1,13 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Network adapter SEA
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class VirtualEthernetAdapter {
public String physicalLocation = "";

View file

@ -1,12 +1,16 @@
package biz.nellemann.hmci.dto.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Storage adapter - NPIV ?
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public final class VirtualFiberChannelAdapter {
public String id = "";
public String wwpn = "";
public String wwpn2 = "";
public String physicalLocation = "";