More robustness towards null metrics.

This commit is contained in:
Mark Nellemann 2021-01-13 08:31:07 +01:00
parent 945c78d868
commit ea7922db7c
35 changed files with 282 additions and 197 deletions

View file

@ -49,6 +49,21 @@ Below are screenshots of the provided Grafana dashboards (found in the **doc/**
- [hmci-lpars](https://bitbucket.org/mnellemann/hmci/downloads/hmci-lpars.png)
## Known problems
### Naming collision
You can't have partitions on different HMC's with the same name, as these cannot be distinguished when metrics are
written to InfluxDB (which uses the name is key).
### Renaming partitions
If you rename a partition, the metrics in InfluxDB will still be available by the old name, and new metrics will be
available by the new name of the partition. There is no easy way to migrate the old data, but you can delete it easily:
DELETE WHERE partition = 'lpar-name';
## Notes
### Start InfluxDB and Grafana at boot on RedHat 7+

View file

@ -1,3 +1,3 @@
id = hmci
group = biz.nellemann.hmci
version = 1.0.1
version = 1.0.2

View file

@ -10,7 +10,7 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class Configuration {
public final class Configuration {
//private final static Logger log = LoggerFactory.getLogger(Configuration.class);
@ -25,17 +25,19 @@ public class Configuration {
TomlParseResult result = Toml.parse(source);
result.errors().forEach(error -> System.err.println(error.toString()));
if(result.contains("refresh")) {
refresh = result.getLong("refresh");
if(result.contains("hmci.refresh")) {
refresh = result.getLong("hmci.refresh");
} else {
refresh = 15L;
refresh = 30L;
}
System.err.println("Refresh: " + refresh);
if(result.contains("rescan")) {
rescan = result.getLong("rescan");
if(result.contains("hmci.rescan")) {
rescan = result.getLong("hmci.rescan");
} else {
rescan = 60L;
}
System.err.println("Rescan: " + refresh);
hmc = getHmc(result);
influx = getInflux(result);

View file

@ -28,11 +28,14 @@ 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;
class HmcClient {
@ -49,6 +52,11 @@ class HmcClient {
protected String authToken;
private final OkHttpClient client;
// OkHttpClient timeouts
private final static int connectTimeout = 2;
private final static int writeTimeout = 3;
private final static int readTimeout = 3;
HmcClient(HmcObject configHmc) {
@ -61,7 +69,7 @@ class HmcClient {
if(unsafe) {
this.client = getUnsafeOkHttpClient();
} else {
this.client = new OkHttpClient();
this.client = getSafeOkHttpClient();
}
}
@ -193,7 +201,7 @@ class HmcClient {
Map<String, LogicalPartition> getLogicalPartitionsForManagedSystem(ManagedSystem system) throws Exception {
URL url = new URL(String.format("%s/rest/api/uom/ManagedSystem/%s/LogicalPartition", baseUrl, system.id));
String responseBody = getResponse(url);
Map<String, LogicalPartition> partitionMap = new HashMap<String, LogicalPartition>();
Map<String, LogicalPartition> partitionMap = new HashMap<>();
// Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
@ -300,7 +308,8 @@ class HmcClient {
/**
* Parse XML feed to get PCM Data in JSON format
* 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
*/
@ -315,7 +324,7 @@ class HmcClient {
// Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++;
log.warn("getPcmDataForEnergy() - empty response");
log.debug("getPcmDataForEnergy() - empty response");
return null;
}
@ -379,7 +388,7 @@ class HmcClient {
/**
* Provide an unsafe (ignoring SSL problems) OkHttpClient
*
* @return unsafe OkHttpClient
* @return OkHttpClient ignoring SSL/TLS errors
*/
private static OkHttpClient getUnsafeOkHttpClient() {
try {
@ -387,8 +396,7 @@ class HmcClient {
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
public void checkClientTrusted(X509Certificate[] chain, String authType) { }
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
@ -411,11 +419,27 @@ class HmcClient {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0]);
builder.hostnameVerifier((hostname, session) -> true);
builder.connectTimeout(connectTimeout, TimeUnit.SECONDS);
builder.writeTimeout(writeTimeout, TimeUnit.SECONDS);
builder.readTimeout(readTimeout, TimeUnit.SECONDS);
return builder.build();
} catch (Exception e) {
} 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(connectTimeout, TimeUnit.SECONDS);
builder.writeTimeout(writeTimeout, TimeUnit.SECONDS);
builder.readTimeout(readTimeout, TimeUnit.SECONDS);
return builder.build();
}
}

View file

@ -125,7 +125,7 @@ class InfluxClient {
void writeManagedSystem(ManagedSystem system) {
if(system.metrics == null) {
log.warn("writeManagedSystem() - null metrics, skipping");
log.debug("writeManagedSystem() - null metrics, skipping");
return;
}
@ -242,13 +242,14 @@ class InfluxClient {
/*
System Energy
Not supported on older HMC (pre v8) or older Power server (pre Power 8)
*/
void writeSystemEnergy(SystemEnergy system) {
if(system.metrics == null) {
log.warn("writeSystemEnergy() - null metrics, skipping");
log.debug("writeSystemEnergy() - null metrics, skipping");
return;
}

View file

@ -17,6 +17,9 @@ package biz.nellemann.hmci;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@ -69,7 +72,7 @@ class Insights {
// Add to list of known systems
if(!systems.containsKey(systemId)) {
systems.put(systemId, system);
log.info("discover() - Found ManagedSystem: " + system);
log.info(hmcId + " discover() - Found ManagedSystem: " + system);
}
// Get LPAR's for this system
@ -79,18 +82,18 @@ class Insights {
// Add to list of known partitions
if(!partitions.containsKey(partitionId)) {
partitions.put(partitionId, partition);
log.info("discover() - Found LogicalPartition: " + partition);
log.info(hmcId + " discover() - Found LogicalPartition: " + partition);
}
});
} catch (Exception e) {
log.error("discover()", e);
log.error(hmcId + " discover() - getLogicalPartitions", e);
}
});
} catch(Exception e) {
log.error("discover() - " + hmcId + " error: " + e.getMessage());
log.error(hmcId + " discover() - getManagedSystems: " + e.getMessage());
}
});
@ -176,7 +179,7 @@ class Insights {
try {
systems.forEach((systemId, system) -> influxClient.writeManagedSystem(system));
} catch (NullPointerException npe) {
log.warn("writeMetricsForManagedSystems() - NPE: " + npe.toString());
log.warn("writeMetricsForManagedSystems() - NPE: " + npe.toString(), npe);
}
}
@ -185,7 +188,7 @@ class Insights {
try {
partitions.forEach((partitionId, partition) -> influxClient.writeLogicalPartition(partition));
} catch (NullPointerException npe) {
log.warn("writeMetricsForLogicalPartitions() - NPE: " + npe.toString());
log.warn("writeMetricsForLogicalPartitions() - NPE: " + npe.toString(), npe);
}
}
@ -194,7 +197,7 @@ class Insights {
try {
systems.forEach((systemId, system) -> influxClient.writeSystemEnergy(system.energy));
} catch (NullPointerException npe) {
log.warn("writeMetricsForSystemEnergy() - NPE: " + npe.toString());
log.warn("writeMetricsForSystemEnergy() - NPE: " + npe.toString(), npe);
}
}
@ -212,6 +215,7 @@ class Insights {
Runtime.getRuntime().addShutdownHook(shutdownHook);
do {
Instant start = Instant.now();
try {
getMetricsForSystems();
getMetricsForPartitions();
@ -222,18 +226,23 @@ class Insights {
writeMetricsForSystemEnergy();
influxClient.writeBatchPoints();
// Refresh HMC's
if (executions > configuration.rescan) {
executions = 0;
discover();
}
} catch (Exception e) {
log.error("run()", e);
}
executions++;
//noinspection BusyWait
sleep(configuration.refresh * 1000);
// Refresh
if (++executions > configuration.rescan) {
executions = 0;
discover();
}
Instant end = Instant.now();
long timeSpend = Duration.between(start, end).getSeconds();
log.debug("run() - duration sec: " + timeSpend);
if(timeSpend < configuration.refresh) {
//noinspection BusyWait
sleep((configuration.refresh - timeSpend) * 1000);
}
} while (keepRunning.get());

View file

@ -50,12 +50,12 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<String, String>();
Map<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
log.debug("getAffinityScore() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
Map<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("affinityScore", metrics.systemUtil.sample.lparsUtil.affinityScore);
log.debug("getAffinityScore() - fields: " + fieldsMap.toString());
@ -68,12 +68,12 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>();
Map<String, String> tagsMap = new HashMap<String, String>();
Map<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
Map<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("logicalMem", metrics.systemUtil.sample.lparsUtil.memory.logicalMem);
fieldsMap.put("backedPhysicalMem", metrics.systemUtil.sample.lparsUtil.memory.backedPhysicalMem);
log.debug("getMemoryMetrics() - fields: " + fieldsMap.toString());
@ -87,12 +87,12 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("utilizedProcUnits", metrics.systemUtil.sample.lparsUtil.processor.utilizedProcUnits);
fieldsMap.put("maxVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.maxVirtualProcessors);
fieldsMap.put("currentVirtualProcessors", metrics.systemUtil.sample.lparsUtil.processor.currentVirtualProcessors);
@ -113,10 +113,13 @@ class LogicalPartition extends MetaSystem {
List<Measurement> getVirtualEthernetAdapterMetrics() {
//List<VirtualEthernetAdapter> metricsList = getListObject(metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters);
List<Measurement> list = new ArrayList<>();
//metricsList.forEach( adapter -> {
metrics.systemUtil.sample.lparsUtil.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("sea", adapter.sharedEthernetAdapterId);
@ -125,7 +128,7 @@ class LogicalPartition extends MetaSystem {
tagsMap.put("vswitchId", adapter.vswitchId.toString());
log.debug("getVirtualEthernetAdapterMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("receivedPhysicalBytes", adapter.receivedPhysicalBytes);
fieldsMap.put("sentPhysicalBytes", adapter.sentPhysicalBytes);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
@ -144,14 +147,14 @@ class LogicalPartition extends MetaSystem {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.lparsUtil.storage.virtualFiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
tagsMap.put("partition", name);
tagsMap.put("viosId", adapter.viosId.toString());
tagsMap.put("wwpn", adapter.wwpn);
log.debug("getVirtualFiberChannelAdaptersMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("transmittedBytes", adapter.transmittedBytes.get(0));
fieldsMap.put("writeBytes", adapter.writeBytes.get(0));
fieldsMap.put("readBytes", adapter.readBytes.get(0));

View file

@ -47,6 +47,7 @@ class ManagedSystem extends MetaSystem {
this.energy = new SystemEnergy(this);
}
@Override
public String toString() {
return String.format("[%s] %s (%s-%s %s)", id, name, type, model, serialNumber);
}
@ -56,11 +57,11 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
log.debug("getMemoryMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
Map<String, Number> 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);
@ -77,11 +78,11 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
log.debug("getProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> 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);
@ -98,12 +99,12 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.serverUtil.sharedProcessorPool.forEach(adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("pool", adapter.name);
log.debug("getSharedProcessorPools() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("assignedProcUnits", adapter.assignedProcUnits);
fieldsMap.put("availableProcUnits", adapter.availableProcUnits);
log.debug("getSharedProcessorPools() - fields: " + fieldsMap.toString());
@ -121,12 +122,12 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
log.debug("getViosMemoryMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
Number assignedMem = getNumberMetricObject(vios.memory.assignedMem);
Number utilizedMem = getNumberMetricObject(vios.memory.utilizedMem);
if(assignedMem != null) {
@ -154,12 +155,12 @@ class ManagedSystem extends MetaSystem {
List<Measurement> list = new ArrayList<>();
metrics.systemUtil.sample.viosUtil.forEach(vios -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
log.debug("getViosProcessorMetrics() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("utilizedProcUnits", vios.processor.utilizedProcUnits);
fieldsMap.put("maxVirtualProcessors", vios.processor.maxVirtualProcessors);
fieldsMap.put("currentVirtualProcessors", vios.processor.currentVirtualProcessors);
@ -185,14 +186,14 @@ class ManagedSystem extends MetaSystem {
vios.network.sharedAdapters.forEach(adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("type", adapter.type);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.debug("getSystemSharedAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
fieldsMap.put("transferredBytes", adapter.transferredBytes);
@ -215,7 +216,7 @@ class ManagedSystem extends MetaSystem {
vios.storage.fiberChannelAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("id", adapter.id);
tagsMap.put("system", name);
tagsMap.put("wwpn", adapter.wwpn);
@ -223,7 +224,7 @@ class ManagedSystem extends MetaSystem {
tagsMap.put("device", adapter.physicalLocation);
log.debug("getSystemFiberChannelAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
@ -312,13 +313,13 @@ class ManagedSystem extends MetaSystem {
vios.network.virtualEthernetAdapters.forEach( adapter -> {
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", name);
tagsMap.put("vios", vios.name);
tagsMap.put("device", adapter.physicalLocation);
log.debug("getSystemGenericVirtualAdapters() - tags: " + tagsMap.toString());
HashMap<String, Number> fieldsMap = new HashMap<String, Number>();
HashMap<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("sentBytes", adapter.sentBytes);
fieldsMap.put("receivedBytes", adapter.receivedBytes);
log.debug("getSystemGenericVirtualAdapters() - fields: " + fieldsMap.toString());

View file

@ -1,3 +1,18 @@
/*
* Copyright 2020 Mark Nellemann <mark.nellemann@gmail.com>
*
* 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 java.util.Map;

View file

@ -28,6 +28,8 @@ import java.math.BigDecimal;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.List;
abstract class MetaSystem {
@ -128,5 +130,18 @@ abstract class MetaSystem {
}
}
static ArrayList getListObject(Object obj) {
ArrayList list;
try {
list = (ArrayList) obj;
} catch (NullPointerException npe) {
log.warn("getListObject()", npe);
list = new ArrayList();
}
return list;
}
}

View file

@ -36,6 +36,7 @@ class SystemEnergy extends MetaSystem {
}
@Override
public String toString() {
return system.name;
}
@ -45,11 +46,11 @@ class SystemEnergy extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
log.debug("getPowerMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
Map<String, Number> fieldsMap = new HashMap<>();
fieldsMap.put("powerReading", metrics.systemUtil.sample.energyUtil.powerUtil.powerReading);
log.debug("getPowerMetrics() - fields: " + fieldsMap.toString());
@ -62,11 +63,11 @@ class SystemEnergy extends MetaSystem {
List<Measurement> list = new ArrayList<>();
HashMap<String, String> tagsMap = new HashMap<String, String>();
HashMap<String, String> tagsMap = new HashMap<>();
tagsMap.put("system", system.name);
log.debug("getThermalMetrics() - tags: " + tagsMap.toString());
Map<String, Number> fieldsMap = new HashMap<String, Number>();
Map<String, Number> fieldsMap = new HashMap<>();
for(Temperature t : metrics.systemUtil.sample.energyUtil.thermalUtil.cpuTemperatures) {
fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading);

View file

@ -8,6 +8,7 @@ import java.util.jar.Manifest;
class VersionProvider implements CommandLine.IVersionProvider {
@Override
public String[] getVersion() throws IOException {
Manifest manifest = new Manifest(getClass().getResourceAsStream("/META-INF/MANIFEST.MF"));

View file

@ -4,10 +4,10 @@ import com.serjltt.moshi.adapters.FirstElement;
public class FiberChannelAdapter {
public String id;
public String wwpn;
public String physicalLocation;
public Integer numOfPorts;
public String id = "";
public String wwpn = "";
public String physicalLocation = "";
public Integer numOfPorts = 0;
@FirstElement
public Number numOfReads;

View file

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

View file

@ -4,9 +4,9 @@ import com.serjltt.moshi.adapters.FirstElement;
public class GenericPhysicalAdapters {
public String id;
public String type;
public String physicalLocation;
public String id = "";
public String type = "";
public String physicalLocation = "";
@FirstElement
public Number numOfReads;

View file

@ -5,10 +5,10 @@ import com.serjltt.moshi.adapters.FirstElement;
public class GenericVirtualAdapter {
public String id;
public String type;
public Integer viosId;
public String physicalLocation;
public String id = "";
public String type = "";
public Integer viosId = 0;
public String physicalLocation = "";
@FirstElement
public Number numOfReads;

View file

@ -4,9 +4,9 @@ import com.serjltt.moshi.adapters.FirstElement;
public class LparProcessor {
public Integer poolId;
public Integer weight;
public String mode;
public Integer poolId = 0;
public Integer weight = 0;
public String mode = "";
@FirstElement
public Number maxVirtualProcessors;

View file

@ -2,16 +2,16 @@ package biz.nellemann.hmci.pcm;
public class LparUtil {
public Integer id;
public String uuid;
public String name;
public String state;
public String type;
public String osType;
public Number affinityScore;
public Integer id = 0;
public String uuid = "";
public String name = "";
public String state = "";
public String type = "";
public String osType = "";
public Number affinityScore = 0.0f;
public LparMemory memory;
public LparProcessor processor;
public LparMemory memory = new LparMemory();
public LparProcessor processor = new LparProcessor();
public Network network = new Network();
public Storage storage = new Storage();

View file

@ -2,6 +2,6 @@ package biz.nellemann.hmci.pcm;
public class PcmData {
public SystemUtil systemUtil;
public SystemUtil systemUtil = new SystemUtil();
}

View file

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

View file

@ -1,3 +1,4 @@
package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;

View file

@ -2,7 +2,7 @@ package biz.nellemann.hmci.pcm;
public class SampleInfo {
public String timeStamp;
public Integer status;
public String timeStamp = "";
public Integer status = 0;
}

View file

@ -5,15 +5,15 @@ import com.serjltt.moshi.adapters.FirstElement;
public class ServerMemory {
@FirstElement
public Number totalMem;
public Number totalMem = 0;
@FirstElement
public Number availableMem;
public Number availableMem = 0;
@FirstElement
public Number configurableMem;
public Number configurableMem = 0;
@FirstElement
public Number assignedMemToLpars;
public Number assignedMemToLpars = 0;
}

View file

@ -5,15 +5,15 @@ import com.serjltt.moshi.adapters.FirstElement;
public class ServerProcessor {
@FirstElement
public Number totalProcUnits;
public Number totalProcUnits = 0;
@FirstElement
public Number utilizedProcUnits;
public Number utilizedProcUnits = 0;
@FirstElement
public Number availableProcUnits;
public Number availableProcUnits = 0;
@FirstElement
public Number configurableProcUnits;
public Number configurableProcUnits = 0;
}

View file

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

View file

@ -4,29 +4,29 @@ import com.serjltt.moshi.adapters.FirstElement;
public class SharedAdapter {
public String id;
public String type;
public String physicalLocation;
public String id = "";
public String type = "";
public String physicalLocation = "";
@FirstElement
public Number receivedPackets;
public Number receivedPackets = 0;
@FirstElement
public Number sentPackets;
public Number sentPackets = 0;
@FirstElement
public Number droppedPackets;
public Number droppedPackets = 0;
@FirstElement
public Number sentBytes;
public Number sentBytes = 0;
@FirstElement
public Number receivedBytes;
public Number receivedBytes = 0;
@FirstElement
public Number transferredBytes;
public Number transferredBytes = 0;
@FirstElement
public String bridgedAdapters;
public String bridgedAdapters = "";
}

View file

@ -4,22 +4,22 @@ import com.serjltt.moshi.adapters.FirstElement;
public class SharedProcessorPool {
public String id;
public String name;
public String id = "";
public String name = "";
@FirstElement
public Number assignedProcUnits;
public Number assignedProcUnits = 0;
@FirstElement
public Number utilizedProcUnits;
public Number utilizedProcUnits = 0;
@FirstElement
public Number availableProcUnits;
public Number availableProcUnits = 0;
@FirstElement
public Number configuredProcUnits;
public Number configuredProcUnits = 0;
@FirstElement
public Number borrowedProcUnits;
public Number borrowedProcUnits = 0;
}

View file

@ -4,10 +4,10 @@ import com.serjltt.moshi.adapters.FirstElement;
public class Temperature {
public String entityId;
public String entityInstance;
public String entityId = "";
public String entityInstance = "";
@FirstElement
public Float temperatureReading;
public Float temperatureReading = 0.0f;
}

View file

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

View file

@ -7,23 +7,13 @@ import java.util.List;
public class UtilSample {
public String sampleType;
public SampleInfo sampleInfo;
public ServerUtil serverUtil;
public String sampleType = "";
public SampleInfo sampleInfo = new SampleInfo();
public ServerUtil serverUtil = new ServerUtil();
public EnergyUtil energyUtil = new EnergyUtil();
public List<ViosUtil> viosUtil = new ArrayList<>();
@FirstElement
public LparUtil lparsUtil;
/*
public LparUtil getLparsUtil() {
if(lparsUtil == null || lparsUtil.isEmpty()) {
return new LparUtil();
} else {
return lparsUtil.get(0);
}
}*/
public LparUtil lparsUtil = new LparUtil();
}

View file

@ -5,9 +5,9 @@ import com.serjltt.moshi.adapters.FirstElement;
public class ViosMemory {
@FirstElement
public Number assignedMem;
public Number assignedMem = 0;
@FirstElement
public Number utilizedMem;
public Number utilizedMem = 0;
}

View file

@ -2,15 +2,15 @@ package biz.nellemann.hmci.pcm;
public class ViosUtil {
public String id;
public String uuid;
public String name;
public String state;
public Integer affinityScore;
public String id = "";
public String uuid = "";
public String name = "";
public String state = "";
public Integer affinityScore = 0;
public ViosMemory memory;
public LparProcessor processor;
public Network network;
public Storage storage;
public ViosMemory memory = new ViosMemory();
public LparProcessor processor = new LparProcessor();
public Network network = new Network();
public Storage storage = new Storage();
}

View file

@ -2,49 +2,50 @@ package biz.nellemann.hmci.pcm;
import com.serjltt.moshi.adapters.FirstElement;
public class VirtualEthernetAdapter {
public String physicalLocation;
public Integer vlanId;
public Integer vswitchId;
public Boolean isPortVlanId;
public Integer viosId;
public String sharedEthernetAdapterId;
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;
public Number receivedPackets = 0;
@FirstElement
public Number sentPackets;
public Number sentPackets = 0;
@FirstElement
public Number droppedPackets;
public Number droppedPackets = 0;
@FirstElement
public Number sentBytes;
public Number sentBytes = 0;
@FirstElement
public Number receivedBytes;
public Number receivedBytes = 0;
@FirstElement
public Number receivedPhysicalPackets;
public Number receivedPhysicalPackets = 0;
@FirstElement
public Number sentPhysicalPackets;
public Number sentPhysicalPackets = 0;
@FirstElement
public Number droppedPhysicalPackets;
public Number droppedPhysicalPackets = 0;
@FirstElement
public Number sentPhysicalBytes;
public Number sentPhysicalBytes = 0;
@FirstElement
public Number receivedPhysicalBytes;
public Number receivedPhysicalBytes = 0;
@FirstElement
public Number transferredBytes;
public Number transferredBytes = 0;
@FirstElement
public Number transferredPhysicalBytes;
public Number transferredPhysicalBytes = 0;
}

View file

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

View file

@ -3,3 +3,4 @@ org.slf4j.simpleLogger.showDateTime=true
org.slf4j.simpleLogger.showShortLogName=true
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
org.slf4j.simpleLogger.levelInBrackets=true
#org.slf4j.simpleLogger.defaultLogLevel=debug