commit
bce1d08c0b
|
@ -2,6 +2,10 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.4.1] - 2011-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
|
||||
- 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.
|
||||
|
@ -24,6 +28,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.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
|
||||
[1.3.0]: https://bitbucket.org/mnellemann/hmci/branches/compare/v1.3.0%0Dv1.2.8
|
||||
|
|
8
TODO.md
Normal file
8
TODO.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# TODO
|
||||
|
||||
In *ManagementConsole run()* - should we try to sleep up until the closest 30/sec interval to get most fresh data?
|
||||
Or should we get more data-samples and keep track of which we have processed already ? And then sleep for shorter times.
|
||||
|
||||
Set how many samples to ask for and process.
|
||||
Loop samples.
|
||||
Keep track of sample status and if they are processed.
|
|
@ -27,7 +27,6 @@ dependencies {
|
|||
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'
|
||||
|
@ -39,7 +38,7 @@ dependencies {
|
|||
|
||||
application {
|
||||
mainClass.set('biz.nellemann.hmci.Application')
|
||||
applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+UseG1GC", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
|
||||
applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx256m", "-XX:+UseG1GC", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
|
||||
}
|
||||
|
||||
java {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_HMCI",
|
||||
"label": "hmci",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_INFLUXDB",
|
||||
"label": "InfluxDB",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_HMCI",
|
||||
"label": "hmci",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_HMCI",
|
||||
"label": "hmci",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_INFLUXDB",
|
||||
"label": "InfluxDB",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_HMCI",
|
||||
"label": "hmci",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
@ -1650,7 +1650,7 @@
|
|||
}
|
||||
],
|
||||
"hide": false,
|
||||
"measurement": "vios_storage_vFC",
|
||||
"measurement": "vios_storage_virtual",
|
||||
"orderByTime": "ASC",
|
||||
"policy": "default",
|
||||
"refId": "B",
|
||||
|
@ -1690,7 +1690,7 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"title": "Virtual Fiber Channel Adapters - $ServerName - $ViosName",
|
||||
"title": "Virtual Adapters - $ServerName - $ViosName",
|
||||
"type": "timeseries"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"__inputs": [
|
||||
{
|
||||
"name": "DS_INFLUXDB",
|
||||
"label": "InfluxDB",
|
||||
"label": "Database",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "influxdb",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
projectId = hmci
|
||||
projectGroup = biz.nellemann.hmci
|
||||
projectVersion = 1.4.0
|
||||
projectVersion = 1.4.1
|
||||
|
|
|
@ -66,6 +66,7 @@ public final class InfluxClient {
|
|||
|
||||
influxDB.enableBatch(
|
||||
BatchOptions.DEFAULTS
|
||||
.flushDuration(5000)
|
||||
.threadFactory(runnable -> {
|
||||
Thread thread = new Thread(runnable);
|
||||
thread.setDaemon(true);
|
||||
|
@ -97,53 +98,46 @@ public final class InfluxClient {
|
|||
}
|
||||
|
||||
|
||||
public void write(List<Measurement> measurements, Instant timestamp, String measurement) {
|
||||
log.debug("write() - measurement: {} {}", measurement, measurements.size());
|
||||
processMeasurementMap(measurements, timestamp, measurement).forEach( (point) -> { influxDB.write(point); });
|
||||
/*
|
||||
public void write(List<Measurement> measurements, Instant timestamp, String name) {
|
||||
log.debug("write() - measurement: {} {}", name, measurements.size());
|
||||
processMeasurementMap(measurements, timestamp, name).forEach( (point) -> { influxDB.write(point); });
|
||||
}*/
|
||||
|
||||
|
||||
public void write(List<Measurement> measurements, String name) {
|
||||
log.debug("write() - measurement: {} {}", name, measurements.size());
|
||||
processMeasurementMap(measurements, name).forEach( (point) -> { influxDB.write(point); });
|
||||
}
|
||||
|
||||
|
||||
private List<Point> processMeasurementMap(List<Measurement> measurements, Instant timestamp, String measurement) {
|
||||
/*
|
||||
private List<Point> processMeasurementMap(List<Measurement> measurements, Instant timestamp, String name) {
|
||||
List<Point> listOfPoints = new ArrayList<>();
|
||||
measurements.forEach( (m) -> {
|
||||
|
||||
Point.Builder builder = Point.measurement(measurement)
|
||||
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS)
|
||||
Point.Builder builder = Point.measurement(name)
|
||||
.time(timestamp.getEpochSecond(), TimeUnit.SECONDS)
|
||||
.tag(m.tags)
|
||||
.fields(m.fields);
|
||||
|
||||
/*
|
||||
// Iterate fields
|
||||
m.fields.forEach((fieldName, fieldValue) -> {
|
||||
|
||||
log.info("processMeasurementMap() {} - fieldName: {}, fieldValue: {}", measurement, fieldName, fieldValue);
|
||||
if(fieldValue instanceof Number) {
|
||||
Number num = (Number) fieldValue;
|
||||
builder.addField(fieldName, num);
|
||||
} else if(fieldValue instanceof Boolean) {
|
||||
Boolean bol = (Boolean) fieldValue;
|
||||
builder.addField(fieldName, bol);
|
||||
} else {
|
||||
String str = (String) fieldValue;
|
||||
builder.addField(fieldName, str);
|
||||
}
|
||||
});
|
||||
|
||||
// Iterate sorted tags
|
||||
Map<String, String> sortedTags = new TreeMap<>(m.tags);
|
||||
sortedTags.forEach((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;
|
||||
}*/
|
||||
|
||||
|
||||
private List<Point> processMeasurementMap(List<Measurement> measurements, String name) {
|
||||
List<Point> listOfPoints = new ArrayList<>();
|
||||
measurements.forEach( (m) -> {
|
||||
log.trace("processMeasurementMap() - timestamp: {}, tags: {}, fields: {}", m.timestamp, m.tags, m.fields);
|
||||
Point.Builder builder = Point.measurement(name)
|
||||
.time(m.timestamp.getEpochSecond(), TimeUnit.SECONDS)
|
||||
.tag(m.tags)
|
||||
.fields(m.fields);
|
||||
listOfPoints.add(builder.build());
|
||||
});
|
||||
return listOfPoints;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ 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;
|
||||
|
@ -28,16 +27,16 @@ 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 Resource {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(LogicalPartition.class);
|
||||
|
||||
private final RestClient restClient;
|
||||
private final InfluxClient influxClient;
|
||||
private final ManagedSystem managedSystem;
|
||||
|
||||
|
||||
protected String id;
|
||||
protected String name;
|
||||
protected LogicalPartitionEntry entry;
|
||||
|
@ -45,9 +44,10 @@ class LogicalPartition extends Resource {
|
|||
private String uriPath;
|
||||
|
||||
|
||||
public LogicalPartition(RestClient restClient, String href, ManagedSystem managedSystem) throws URISyntaxException {
|
||||
public LogicalPartition(RestClient restClient, InfluxClient influxClient, String href, ManagedSystem managedSystem) throws URISyntaxException {
|
||||
log.debug("LogicalPartition() - {}", href);
|
||||
this.restClient = restClient;
|
||||
this.influxClient = influxClient;
|
||||
this.managedSystem = managedSystem;
|
||||
try {
|
||||
URI uri = new URI(href);
|
||||
|
@ -99,9 +99,9 @@ class LogicalPartition extends Resource {
|
|||
|
||||
public void refresh() {
|
||||
|
||||
log.debug("refresh()");
|
||||
log.debug("refresh() - {}", name);
|
||||
try {
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/LogicalPartition/%s/ProcessedMetrics?NoOfSamples=1", managedSystem.id, id));
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/LogicalPartition/%s/ProcessedMetrics?NoOfSamples=%d", managedSystem.id, id, noOfSamples));
|
||||
|
||||
// Do not try to parse empty response
|
||||
if(xml == null || xml.length() <= 1) {
|
||||
|
@ -134,248 +134,235 @@ class LogicalPartition extends Resource {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(int sample) throws NullPointerException {
|
||||
log.debug("process() - {} - sample: {}", name, sample);
|
||||
|
||||
influxClient.write(getDetails(sample),"lpar_details");
|
||||
influxClient.write(getMemoryMetrics(sample),"lpar_memory");
|
||||
influxClient.write(getProcessorMetrics(sample),"lpar_processor");
|
||||
influxClient.write(getSriovLogicalPorts(sample),"lpar_net_sriov");
|
||||
influxClient.write(getVirtualEthernetAdapterMetrics(sample),"lpar_net_virtual");
|
||||
influxClient.write(getVirtualGenericAdapterMetrics(sample),"lpar_storage_virtual");
|
||||
influxClient.write(getVirtualFibreChannelAdapterMetrics(sample),"lpar_storage_vFC");
|
||||
}
|
||||
|
||||
|
||||
// LPAR Details
|
||||
List<Measurement> getDetails() {
|
||||
List<Measurement> getDetails(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Map<String, String> tagsMap = new HashMap<>();
|
||||
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||
Map<String, String> tagsMap = new HashMap<>();
|
||||
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||
|
||||
tagsMap.put("servername", managedSystem.entry.getName());
|
||||
tagsMap.put("lparname", entry.getName());
|
||||
log.trace("getDetails() - tags: " + tagsMap);
|
||||
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);
|
||||
fieldsMap.put("id", metric.getSample(sample).lparsUtil.id);
|
||||
fieldsMap.put("type", metric.getSample(sample).lparsUtil.type);
|
||||
fieldsMap.put("state", metric.getSample(sample).lparsUtil.state);
|
||||
fieldsMap.put("osType", metric.getSample(sample).lparsUtil.osType);
|
||||
fieldsMap.put("affinityScore", metric.getSample(sample).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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Memory
|
||||
List<Measurement> getMemoryMetrics() {
|
||||
List<Measurement> getMemoryMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Map<String, String> tagsMap = new HashMap<>();
|
||||
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||
Map<String, String> tagsMap = new HashMap<>();
|
||||
TreeMap<String, Object> fieldsMap = new TreeMap<>();
|
||||
|
||||
tagsMap.put("servername", managedSystem.entry.getName());
|
||||
tagsMap.put("lparname", entry.getName());
|
||||
log.trace("getMemoryMetrics() - tags: " + tagsMap);
|
||||
tagsMap.put("servername", managedSystem.entry.getName());
|
||||
tagsMap.put("lparname", entry.getName());
|
||||
log.trace("getMemoryMetrics() - tags: " + tagsMap);
|
||||
|
||||
fieldsMap.put("logicalMem", metric.getSample().lparsUtil.memory.logicalMem);
|
||||
fieldsMap.put("backedPhysicalMem", metric.getSample().lparsUtil.memory.backedPhysicalMem);
|
||||
log.trace("getMemoryMetrics() - fields: " + fieldsMap);
|
||||
fieldsMap.put("logicalMem", metric.getSample(sample).lparsUtil.memory.logicalMem);
|
||||
fieldsMap.put("backedPhysicalMem", metric.getSample(sample).lparsUtil.memory.backedPhysicalMem);
|
||||
log.trace("getMemoryMetrics() - fields: " + fieldsMap);
|
||||
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
} catch (Exception e) {
|
||||
log.warn("getMemoryMetrics() - error: {}", e.getMessage());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Processor
|
||||
List<Measurement> getProcessorMetrics() {
|
||||
List<Measurement> getProcessorMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", managedSystem.entry.getName());
|
||||
tagsMap.put("lparname", entry.getName());
|
||||
log.trace("getProcessorMetrics() - tags: " + tagsMap);
|
||||
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);
|
||||
fieldsMap.put("utilizedProcUnits", metric.getSample(sample).lparsUtil.processor.utilizedProcUnits);
|
||||
fieldsMap.put("entitledProcUnits", metric.getSample(sample).lparsUtil.processor.entitledProcUnits);
|
||||
fieldsMap.put("donatedProcUnits", metric.getSample(sample).lparsUtil.processor.donatedProcUnits);
|
||||
fieldsMap.put("idleProcUnits", metric.getSample(sample).lparsUtil.processor.idleProcUnits);
|
||||
fieldsMap.put("maxProcUnits", metric.getSample(sample).lparsUtil.processor.maxProcUnits);
|
||||
fieldsMap.put("maxVirtualProcessors", metric.getSample(sample).lparsUtil.processor.maxVirtualProcessors);
|
||||
fieldsMap.put("currentVirtualProcessors", metric.getSample(sample).lparsUtil.processor.currentVirtualProcessors);
|
||||
fieldsMap.put("utilizedCappedProcUnits", metric.getSample(sample).lparsUtil.processor.utilizedCappedProcUnits);
|
||||
fieldsMap.put("utilizedUncappedProcUnits", metric.getSample(sample).lparsUtil.processor.utilizedUncappedProcUnits);
|
||||
fieldsMap.put("timePerInstructionExecution", metric.getSample(sample).lparsUtil.processor.timeSpentWaitingForDispatch);
|
||||
fieldsMap.put("timeSpentWaitingForDispatch", metric.getSample(sample).lparsUtil.processor.timePerInstructionExecution);
|
||||
fieldsMap.put("mode", metric.getSample(sample).lparsUtil.processor.mode);
|
||||
fieldsMap.put("weight", metric.getSample(sample).lparsUtil.processor.weight);
|
||||
fieldsMap.put("poolId", metric.getSample(sample).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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Network - Virtual
|
||||
List<Measurement> getVirtualEthernetAdapterMetrics() {
|
||||
List<Measurement> getVirtualEthernetAdapterMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
metric.getSample().lparsUtil.network.virtualEthernetAdapters.forEach(adapter -> {
|
||||
metric.getSample(sample).lparsUtil.network.virtualEthernetAdapters.forEach(adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVirtualEthernetAdapterMetrics() - error: {}", e.getMessage());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Storage - Virtual Generic
|
||||
List<Measurement> getVirtualGenericAdapterMetrics() {
|
||||
List<Measurement> getVirtualGenericAdapterMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
metric.getSample().lparsUtil.storage.genericVirtualAdapters.forEach(adapter -> {
|
||||
metric.getSample(sample).lparsUtil.storage.genericVirtualAdapters.forEach(adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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);
|
||||
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());
|
||||
}
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Storage - Virtual FC
|
||||
List<Measurement> getVirtualFibreChannelAdapterMetrics() {
|
||||
List<Measurement> getVirtualFibreChannelAdapterMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
metric.getSample().lparsUtil.storage.virtualFiberChannelAdapters.forEach(adapter -> {
|
||||
metric.getSample(sample).lparsUtil.storage.virtualFiberChannelAdapters.forEach(adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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);
|
||||
log.trace("getVirtualFibreChannelAdapterMetrics() - tags: " + tagsMap);
|
||||
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);
|
||||
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);
|
||||
log.trace("getVirtualFibreChannelAdapterMetrics() - fields: " + fieldsMap);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVirtualFibreChannelAdapterMetrics() - error: {}", e.getMessage());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// LPAR Network - SR-IOV Logical Ports
|
||||
List<Measurement> getSriovLogicalPorts() {
|
||||
List<Measurement> getSriovLogicalPorts(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
metric.getSample().lparsUtil.network.sriovLogicalPorts.forEach(port -> {
|
||||
metric.getSample(sample).lparsUtil.network.sriovLogicalPorts.forEach(port -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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);
|
||||
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);
|
||||
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());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ package biz.nellemann.hmci;
|
|||
|
||||
import biz.nellemann.hmci.dto.xml.*;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,6 +37,8 @@ class ManagedSystem extends Resource {
|
|||
private List<String> includePartitions = new ArrayList<>();
|
||||
|
||||
private final RestClient restClient;
|
||||
private final InfluxClient influxClient;
|
||||
|
||||
|
||||
protected ManagedSystemEntry entry;
|
||||
|
||||
|
@ -52,9 +52,10 @@ class ManagedSystem extends Resource {
|
|||
public String id;
|
||||
|
||||
|
||||
public ManagedSystem(RestClient restClient, String href) {
|
||||
public ManagedSystem(RestClient restClient, InfluxClient influxClient, String href) {
|
||||
log.debug("ManagedSystem() - {}", href);
|
||||
this.restClient = restClient;
|
||||
this.influxClient = influxClient;
|
||||
try {
|
||||
URI uri = new URI(href);
|
||||
uriPath = uri.getPath();
|
||||
|
@ -89,6 +90,7 @@ class ManagedSystem extends Resource {
|
|||
setPcmPreference();
|
||||
}
|
||||
|
||||
systemEnergy = new SystemEnergy(restClient, influxClient, this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +124,7 @@ class ManagedSystem extends Resource {
|
|||
|
||||
logicalPartitions.clear();
|
||||
for (Link link : this.entry.getAssociatedLogicalPartitions()) {
|
||||
LogicalPartition logicalPartition = new LogicalPartition(restClient, link.getHref(), this);
|
||||
LogicalPartition logicalPartition = new LogicalPartition(restClient, influxClient, link.getHref(), this);
|
||||
logicalPartition.discover();
|
||||
if(Objects.equals(logicalPartition.entry.partitionState, "running")) {
|
||||
// Check exclude / include
|
||||
|
@ -152,9 +154,9 @@ class ManagedSystem extends Resource {
|
|||
|
||||
public void refresh() {
|
||||
|
||||
log.debug("refresh()");
|
||||
log.debug("refresh() - {}", name);
|
||||
try {
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=1", id));
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?NoOfSamples=%d", id, noOfSamples));
|
||||
|
||||
// Do not try to parse empty response
|
||||
if(xml == null || xml.length() <= 1) {
|
||||
|
@ -180,6 +182,12 @@ class ManagedSystem extends Resource {
|
|||
}
|
||||
});
|
||||
|
||||
if(systemEnergy != null) {
|
||||
systemEnergy.refresh();
|
||||
}
|
||||
|
||||
logicalPartitions.forEach(LogicalPartition::refresh);
|
||||
|
||||
} catch (JsonParseException e) {
|
||||
log.warn("refresh() - parse error for: {}", name);
|
||||
metric = null;
|
||||
|
@ -190,6 +198,38 @@ class ManagedSystem extends Resource {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(int sample) throws NullPointerException {
|
||||
|
||||
log.debug("process() - {} - sample: {}", name, sample);
|
||||
|
||||
influxClient.write(getDetails(sample),"server_details");
|
||||
influxClient.write(getMemoryMetrics(sample),"server_memory");
|
||||
influxClient.write(getProcessorMetrics(sample), "server_processor");
|
||||
influxClient.write(getPhysicalProcessorPool(sample),"server_physicalProcessorPool");
|
||||
influxClient.write(getSharedProcessorPools(sample),"server_sharedProcessorPool");
|
||||
if(systemEnergy != null) {
|
||||
systemEnergy.process();
|
||||
}
|
||||
|
||||
influxClient.write(getVioDetails(sample),"vios_details");
|
||||
influxClient.write(getVioProcessorMetrics(sample),"vios_processor");
|
||||
influxClient.write(getVioMemoryMetrics(sample),"vios_memory");
|
||||
influxClient.write(getVioNetworkLpars(sample),"vios_network_lpars");
|
||||
influxClient.write(getVioNetworkVirtualAdapters(sample),"vios_network_virtual");
|
||||
influxClient.write(getVioNetworkSharedAdapters(sample),"vios_network_shared");
|
||||
influxClient.write(getVioNetworkGenericAdapters(sample),"vios_network_generic");
|
||||
influxClient.write(getVioStorageLpars(sample),"vios_storage_lpars");
|
||||
influxClient.write(getVioStorageFiberChannelAdapters(sample),"vios_storage_FC");
|
||||
influxClient.write(getVioStorageVirtualAdapters(sample),"vios_storage_virtual");
|
||||
influxClient.write(getVioStoragePhysicalAdapters(sample),"vios_storage_physical");
|
||||
// Missing: vios_storage_SSP
|
||||
|
||||
logicalPartitions.forEach(Resource::process);
|
||||
}
|
||||
|
||||
|
||||
public void setPcmPreference() {
|
||||
log.info("setPcmPreference()");
|
||||
|
||||
|
@ -250,149 +290,124 @@ class ManagedSystem extends Resource {
|
|||
|
||||
|
||||
// System details
|
||||
List<Measurement> getDetails() {
|
||||
List<Measurement> getDetails(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
Map<String, String> tagsMap = new TreeMap<>();
|
||||
Map<String, Object> fieldsMap = new TreeMap<>();
|
||||
|
||||
try {
|
||||
Map<String, String> tagsMap = new TreeMap<>();
|
||||
Map<String, Object> fieldsMap = new TreeMap<>();
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getDetails() - tags: " + tagsMap);
|
||||
|
||||
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(sample).systemFirmwareUtil.utilizedProcUnits);
|
||||
fieldsMap.put("assignedMem", metric.getSample(sample).systemFirmwareUtil.assignedMem);
|
||||
log.trace("getDetails() - fields: " + fieldsMap);
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// System Memory
|
||||
List<Measurement> getMemoryMetrics() {
|
||||
List<Measurement> getMemoryMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
Map<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
Map<String, Object> fieldsMap = new HashMap<>();
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getMemoryMetrics() - tags: " + tagsMap);
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getMemoryMetrics() - tags: " + tagsMap);
|
||||
fieldsMap.put("totalMem", metric.getSample(sample).serverUtil.memory.totalMem);
|
||||
fieldsMap.put("availableMem", metric.getSample(sample).serverUtil.memory.availableMem);
|
||||
fieldsMap.put("configurableMem", metric.getSample(sample).serverUtil.memory.configurableMem);
|
||||
fieldsMap.put("assignedMemToLpars", metric.getSample(sample).serverUtil.memory.assignedMemToLpars);
|
||||
fieldsMap.put("virtualPersistentMem", metric.getSample(sample).serverUtil.memory.virtualPersistentMem);
|
||||
log.trace("getMemoryMetrics() - fields: " + fieldsMap);
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// System Processor
|
||||
List<Measurement> getProcessorMetrics() {
|
||||
List<Measurement> getProcessorMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getProcessorMetrics() - tags: " + tagsMap);
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getProcessorMetrics() - tags: " + tagsMap);
|
||||
fieldsMap.put("totalProcUnits", metric.getSample(sample).serverUtil.processor.totalProcUnits);
|
||||
fieldsMap.put("utilizedProcUnits", metric.getSample(sample).serverUtil.processor.utilizedProcUnits);
|
||||
fieldsMap.put("availableProcUnits", metric.getSample(sample).serverUtil.processor.availableProcUnits);
|
||||
fieldsMap.put("configurableProcUnits", metric.getSample(sample).serverUtil.processor.configurableProcUnits);
|
||||
log.trace("getProcessorMetrics() - fields: " + fieldsMap);
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// Sytem Shared ProcessorPools
|
||||
List<Measurement> getSharedProcessorPools() {
|
||||
List<Measurement> getSharedProcessorPools(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
|
||||
metric.getSample().serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("pool", String.valueOf(sharedProcessorPool.id));
|
||||
tagsMap.put("poolname", sharedProcessorPool.name);
|
||||
log.trace("getSharedProcessorPools() - tags: " + tagsMap);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// System Physical ProcessorPool
|
||||
List<Measurement> getPhysicalProcessorPool() {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
metric.getSample(sample).serverUtil.sharedProcessorPool.forEach(sharedProcessorPool -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getPhysicalProcessorPool() - tags: " + tagsMap);
|
||||
tagsMap.put("pool", String.valueOf(sharedProcessorPool.id));
|
||||
tagsMap.put("poolname", sharedProcessorPool.name);
|
||||
log.trace("getSharedProcessorPools() - 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);
|
||||
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("getPhysicalProcessorPool() - error: {}", e.getMessage());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// System Physical ProcessorPool
|
||||
List<Measurement> getPhysicalProcessorPool(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
log.trace("getPhysicalProcessorPool() - tags: " + tagsMap);
|
||||
|
||||
fieldsMap.put("assignedProcUnits", metric.getSample(sample).serverUtil.physicalProcessorPool.assignedProcUnits);
|
||||
fieldsMap.put("availableProcUnits", metric.getSample(sample).serverUtil.physicalProcessorPool.availableProcUnits);
|
||||
fieldsMap.put("utilizedProcUnits", metric.getSample(sample).serverUtil.physicalProcessorPool.utilizedProcUnits);
|
||||
fieldsMap.put("configuredProcUnits", metric.getSample(sample).serverUtil.physicalProcessorPool.configuredProcUnits);
|
||||
fieldsMap.put("borrowedProcUnits", metric.getSample(sample).serverUtil.physicalProcessorPool.borrowedProcUnits);
|
||||
log.trace("getPhysicalProcessorPool() - fields: " + fieldsMap);
|
||||
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -404,385 +419,339 @@ class ManagedSystem extends Resource {
|
|||
|
||||
|
||||
// VIO Details
|
||||
List<Measurement> getVioDetails() {
|
||||
List<Measurement> getVioDetails(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioDetails() - tags: " + tagsMap);
|
||||
|
||||
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);
|
||||
|
||||
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());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Memory
|
||||
List<Measurement> getVioMemoryMetrics() {
|
||||
List<Measurement> getVioMemoryMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioMemoryMetrics() - tags: " + tagsMap);
|
||||
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);
|
||||
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());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Processor
|
||||
List<Measurement> getVioProcessorMetrics() {
|
||||
List<Measurement> getVioProcessorMetrics(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioProcessorMetrics() - tags: " + tagsMap);
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioProcessorMetrics() - tags: " + tagsMap);
|
||||
|
||||
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);
|
||||
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());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIOs - Network
|
||||
List<Measurement> getVioNetworkLpars() {
|
||||
List<Measurement> getVioNetworkLpars(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioNetworkLpars() - tags: " + tagsMap);
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioNetworkLpars() - tags: " + tagsMap);
|
||||
|
||||
fieldsMap.put("clientlpars", vio.network.clientLpars.size());
|
||||
log.trace("getVioNetworkLpars() - fields: " + 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());
|
||||
}
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Network - Shared
|
||||
List<Measurement> getVioNetworkSharedAdapters() {
|
||||
List<Measurement> getVioNetworkSharedAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
vio.network.sharedAdapters.forEach(adapter -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
vio.network.sharedAdapters.forEach(adapter -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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("getVioNetworkSharedAdapters() - tags: " + tagsMap);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
});
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioNetworkSharedAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Network - Virtual
|
||||
List<Measurement> getVioNetworkVirtualAdapters() {
|
||||
List<Measurement> getVioNetworkVirtualAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
metric.getSample(sample).viosUtil.forEach( vio -> {
|
||||
vio.network.virtualEthernetAdapters.forEach( adapter -> {
|
||||
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach( vio -> {
|
||||
vio.network.virtualEthernetAdapters.forEach( adapter -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioNetworkVirtualAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Network - Generic
|
||||
List<Measurement> getVioNetworkGenericAdapters() {
|
||||
List<Measurement> getVioNetworkGenericAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach( vio -> {
|
||||
vio.network.genericAdapters.forEach( adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
});
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioNetworkGenericAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// VIOs - Storage
|
||||
List<Measurement> getVioStorageLpars() {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach(vio -> {
|
||||
metric.getSample(sample).viosUtil.forEach( vio -> {
|
||||
vio.network.genericAdapters.forEach( adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
tagsMap.put("id", adapter.id);
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioStorageLpars() - tags: " + tagsMap);
|
||||
tagsMap.put("location", adapter.physicalLocation);
|
||||
log.trace("getVioNetworkGenericAdapters() - tags: " + tagsMap);
|
||||
|
||||
fieldsMap.put("clientlpars", vio.storage.clientLpars.size());
|
||||
log.trace("getVioStorageLpars() - fields: " + fieldsMap);
|
||||
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);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioStorageLpars() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// VIO Storage FC
|
||||
List<Measurement> getVioStorageFiberChannelAdapters() {
|
||||
|
||||
// VIOs - Storage
|
||||
List<Measurement> getVioStorageLpars(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach( vio -> {
|
||||
log.trace("getVioStorageFiberChannelAdapters() - VIO: " + vio.name);
|
||||
metric.getSample(sample).viosUtil.forEach(vio -> {
|
||||
|
||||
vio.storage.fiberChannelAdapters.forEach( adapter -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
tagsMap.put("servername", entry.getName());
|
||||
tagsMap.put("viosname", vio.name);
|
||||
log.trace("getVioStorageLpars() - tags: " + tagsMap);
|
||||
|
||||
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("clientlpars", vio.storage.clientLpars.size());
|
||||
log.trace("getVioStorageLpars() - fields: " + fieldsMap);
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Storage FC
|
||||
List<Measurement> getVioStorageFiberChannelAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
metric.getSample(sample).viosUtil.forEach( vio -> {
|
||||
log.trace("getVioStorageFiberChannelAdapters() - VIO: " + vio.name);
|
||||
|
||||
vio.storage.fiberChannelAdapters.forEach( adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
|
||||
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(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioStorageFiberChannelAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Storage - Physical
|
||||
List<Measurement> getVioStoragePhysicalAdapters() {
|
||||
List<Measurement> getVioStoragePhysicalAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach( vio -> {
|
||||
log.trace("getVioStoragePhysicalAdapters() - VIO: " + vio.name);
|
||||
metric.getSample(sample).viosUtil.forEach( vio -> {
|
||||
log.trace("getVioStoragePhysicalAdapters() - VIO: " + vio.name);
|
||||
|
||||
vio.storage.genericPhysicalAdapters.forEach( adapter -> {
|
||||
vio.storage.genericPhysicalAdapters.forEach( adapter -> {
|
||||
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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);
|
||||
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);
|
||||
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));
|
||||
});
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioStoragePhysicalAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// VIO Storage - Virtual
|
||||
List<Measurement> getVioStorageVirtualAdapters() {
|
||||
List<Measurement> getVioStorageVirtualAdapters(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
metric.getSample().viosUtil.forEach( (vio) -> {
|
||||
vio.storage.genericVirtualAdapters.forEach( (adapter) -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> fieldsMap = new HashMap<>();
|
||||
metric.getSample(sample).viosUtil.forEach( (vio) -> {
|
||||
vio.storage.genericVirtualAdapters.forEach( (adapter) -> {
|
||||
HashMap<String, String> tagsMap = new HashMap<>();
|
||||
HashMap<String, Object> 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);
|
||||
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);
|
||||
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));
|
||||
});
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("getVioStorageVirtualAdapters() - error: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -790,10 +759,10 @@ class ManagedSystem extends Resource {
|
|||
|
||||
/*
|
||||
// VIO Storage SSP TODO
|
||||
List<Measurement> getViosStorageSharedStoragePools() {
|
||||
List<Measurement> getViosStorageSharedStoragePools(int sample) throws NullPointerException {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
metrics.systemUtil.sample.viosUtil.forEach( vios -> {
|
||||
metrics.systemUtil.getSample(sample).viosUtil.forEach( vios -> {
|
||||
|
||||
vios.storage.fiberChannelAdapters.forEach( adapter -> {
|
||||
|
||||
|
@ -813,7 +782,7 @@ class ManagedSystem extends Resource {
|
|||
fieldsMap.put("physicalLocation", adapter.physicalLocation);
|
||||
log.trace("getViosStorageSharedStoragePools() - fields: " + fieldsMap.toString());
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
});
|
||||
|
||||
log.trace("getViosStorageSharedStoragePools() - VIOS: " + vios.name);
|
||||
|
|
|
@ -61,19 +61,6 @@ class ManagementConsole implements Runnable {
|
|||
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("ManagementConsole() - can't write to trace dir: " + traceDir.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("ManagementConsole() - trace error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
this.excludeSystems = configuration.excludeSystems;
|
||||
this.includeSystems = configuration.includeSystems;
|
||||
this.excludePartitions = configuration.excludePartitions;
|
||||
|
@ -160,7 +147,7 @@ class ManagementConsole implements Runnable {
|
|||
|
||||
managedSystems.clear();
|
||||
for (Link link : entry.getAssociatedManagedSystems()) {
|
||||
ManagedSystem managedSystem = new ManagedSystem(restClient, link.getHref());
|
||||
ManagedSystem managedSystem = new ManagedSystem(restClient, influxClient, link.getHref());
|
||||
managedSystem.setExcludePartitions(excludePartitions);
|
||||
managedSystem.setIncludePartitions(includePartitions);
|
||||
managedSystem.discover();
|
||||
|
@ -202,63 +189,10 @@ class ManagementConsole implements Runnable {
|
|||
}
|
||||
|
||||
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(system.systemEnergy != null) {
|
||||
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");
|
||||
});
|
||||
system.process();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -15,14 +15,23 @@
|
|||
*/
|
||||
package biz.nellemann.hmci;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
public class Measurement {
|
||||
|
||||
final Instant timestamp;
|
||||
final Map<String, String> tags;
|
||||
final Map<String, Object> fields;
|
||||
|
||||
Measurement(Map<String, String> tags, Map<String, Object> fields) {
|
||||
this.timestamp = Instant.now();
|
||||
this.tags = tags;
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
Measurement(Instant timestamp, Map<String, String> tags, Map<String, Object> fields) {
|
||||
this.timestamp = timestamp;
|
||||
this.tags = tags;
|
||||
this.fields = fields;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package biz.nellemann.hmci;
|
|||
|
||||
import biz.nellemann.hmci.dto.json.ProcessedMetrics;
|
||||
import biz.nellemann.hmci.dto.json.SystemUtil;
|
||||
import biz.nellemann.hmci.dto.json.UtilSample;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -10,14 +11,20 @@ import org.slf4j.LoggerFactory;
|
|||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Resource {
|
||||
public abstract class Resource {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(Resource.class);
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private final ArrayList<String> sampleHistory = new ArrayList<>();
|
||||
|
||||
protected SystemUtil metric;
|
||||
protected final int maxNumberOfSamples = 60;
|
||||
protected final int minNumberOfSamples = 5;
|
||||
protected int noOfSamples = maxNumberOfSamples;
|
||||
|
||||
|
||||
|
||||
Resource() {
|
||||
|
@ -35,6 +42,7 @@ public class Resource {
|
|||
try {
|
||||
ProcessedMetrics processedMetrics = objectMapper.readValue(json, ProcessedMetrics.class);
|
||||
metric = processedMetrics.systemUtil;
|
||||
log.trace("deserialize() - samples: {}", metric.samples.size());
|
||||
} catch (Exception e) {
|
||||
log.error("deserialize() - error: {}", e.getMessage());
|
||||
}
|
||||
|
@ -61,4 +69,68 @@ public class Resource {
|
|||
return instant;
|
||||
}
|
||||
|
||||
|
||||
Instant getTimestamp(int sampleNumber) {
|
||||
Instant instant = Instant.now();
|
||||
|
||||
if (metric == null) {
|
||||
return instant;
|
||||
}
|
||||
|
||||
String timestamp = metric.getSample(sampleNumber).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;
|
||||
}
|
||||
|
||||
|
||||
public void process() {
|
||||
|
||||
if(metric == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int processed = 0;
|
||||
int sampleSize = metric.samples.size();
|
||||
log.debug("process() - Samples Returned: {}, Samples in History: {}, Fetch Next Counter: {}", sampleSize, sampleHistory.size(), noOfSamples);
|
||||
for(int i = 0; i<sampleSize; i++) {
|
||||
UtilSample sample = metric.getSample(i);
|
||||
String timestamp = sample.getInfo().timestamp;
|
||||
|
||||
if(sampleHistory.contains(timestamp)) {
|
||||
//log.info("process() - Sample \"{}\" already processed", timestamp);
|
||||
continue; // Already processed
|
||||
}
|
||||
|
||||
try {
|
||||
process(i);
|
||||
processed++;
|
||||
sampleHistory.add(timestamp); // Add to processed history
|
||||
} catch (NullPointerException e) {
|
||||
log.warn("process() - error: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove old elements from history
|
||||
for(int n = noOfSamples; n < sampleHistory.size(); n++) {
|
||||
//log.info("process() - Removing element no. {} from sampleHistory: {}", n, sampleHistory.get(0));
|
||||
sampleHistory.remove(0);
|
||||
}
|
||||
|
||||
// Decrease down to minSamples
|
||||
if(noOfSamples > minNumberOfSamples) {
|
||||
noOfSamples = Math.min( (noOfSamples - 1), Math.max( (noOfSamples - processed) + 5, minNumberOfSamples));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract void process(int sample) throws NullPointerException;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ public class RestClient {
|
|||
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;
|
||||
private final static int CONNECT_TIMEOUT_SEC = 10;
|
||||
private final static int WRITE_TIMEOUT_SEC = 30;
|
||||
private final static int READ_TIMEOUT_SEC = 180;
|
||||
|
||||
protected String authToken;
|
||||
protected final String baseUrl;
|
||||
|
@ -48,6 +48,21 @@ public class RestClient {
|
|||
} else {
|
||||
this.httpClient = getSafeOkHttpClient();
|
||||
}
|
||||
|
||||
/*
|
||||
if(configuration.trace != null) {
|
||||
try {
|
||||
File traceDir = new File(configuration.trace);
|
||||
traceDir.mkdirs();
|
||||
if(traceDir.canWrite()) {
|
||||
Boolean doTrace = true;
|
||||
} else {
|
||||
log.warn("ManagementConsole() - can't write to trace dir: " + traceDir.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("ManagementConsole() - trace error: " + e.getMessage());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,7 +165,7 @@ public class RestClient {
|
|||
*/
|
||||
public synchronized String getRequest(URL url) throws IOException {
|
||||
|
||||
log.trace("getRequest() - URL: {}", url.toString());
|
||||
log.debug("getRequest() - URL: {}", url.toString());
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
|
@ -196,7 +211,7 @@ public class RestClient {
|
|||
String responseBody = null;
|
||||
try (Response responseRetry = httpClient.newCall(request).execute()) {
|
||||
if(responseRetry.isSuccessful()) {
|
||||
responseBody = responseRetry.body().string();
|
||||
responseBody = Objects.requireNonNull(responseRetry.body()).string();
|
||||
}
|
||||
}
|
||||
return responseBody;
|
||||
|
@ -205,10 +220,6 @@ public class RestClient {
|
|||
|
||||
/**
|
||||
* Send a POST request with a payload (can be null) to the HMC
|
||||
* @param url
|
||||
* @param payload
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public synchronized String postRequest(URL url, String payload) throws IOException {
|
||||
|
||||
|
@ -276,9 +287,9 @@ public class RestClient {
|
|||
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);
|
||||
builder.connectTimeout(CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
builder.writeTimeout(WRITE_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
builder.readTimeout(READ_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
|
||||
return builder.build();
|
||||
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||
|
@ -293,11 +304,28 @@ public class RestClient {
|
|||
*/
|
||||
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);
|
||||
builder.connectTimeout(CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
builder.writeTimeout(WRITE_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
builder.readTimeout(READ_TIMEOUT_SEC, TimeUnit.SECONDS);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -15,15 +15,17 @@ class SystemEnergy extends Resource {
|
|||
private final static Logger log = LoggerFactory.getLogger(SystemEnergy.class);
|
||||
|
||||
private final RestClient restClient;
|
||||
private final InfluxClient influxClient;
|
||||
private final ManagedSystem managedSystem;
|
||||
|
||||
protected String id;
|
||||
protected String name;
|
||||
|
||||
|
||||
public SystemEnergy(RestClient restClient, ManagedSystem managedSystem) {
|
||||
public SystemEnergy(RestClient restClient, InfluxClient influxClient, ManagedSystem managedSystem) {
|
||||
log.debug("SystemEnergy()");
|
||||
this.restClient = restClient;
|
||||
this.influxClient = influxClient;
|
||||
this.managedSystem = managedSystem;
|
||||
}
|
||||
|
||||
|
@ -32,7 +34,7 @@ class SystemEnergy extends Resource {
|
|||
|
||||
log.debug("refresh()");
|
||||
try {
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?Type=Energy&NoOfSamples=1", managedSystem.id));
|
||||
String xml = restClient.getRequest(String.format("/rest/api/pcm/ManagedSystem/%s/ProcessedMetrics?Type=Energy&NoOfSamples=%d", managedSystem.id, noOfSamples));
|
||||
|
||||
// Do not try to parse empty response
|
||||
if(xml == null || xml.length() <= 1) {
|
||||
|
@ -66,8 +68,17 @@ class SystemEnergy extends Resource {
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public void process(int sample) {
|
||||
if(metric != null) {
|
||||
log.debug("process() - sample: {}", sample);
|
||||
influxClient.write(getPowerMetrics(sample), "server_energy_power");
|
||||
influxClient.write(getThermalMetrics(sample), "server_energy_thermal");
|
||||
}
|
||||
}
|
||||
|
||||
List<Measurement> getPowerMetrics() {
|
||||
|
||||
List<Measurement> getPowerMetrics(int sample) {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
|
@ -77,10 +88,10 @@ class SystemEnergy extends Resource {
|
|||
tagsMap.put("servername", managedSystem.name);
|
||||
log.trace("getPowerMetrics() - tags: {}", tagsMap);
|
||||
|
||||
fieldsMap.put("powerReading", metric.getSample().energyUtil.powerUtil.powerReading);
|
||||
fieldsMap.put("powerReading", metric.getSample(sample).energyUtil.powerUtil.powerReading);
|
||||
log.trace("getPowerMetrics() - fields: {}", fieldsMap);
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
} catch (Exception e) {
|
||||
log.warn("getPowerMetrics() - error: {}", e.getMessage());
|
||||
}
|
||||
|
@ -89,7 +100,7 @@ class SystemEnergy extends Resource {
|
|||
}
|
||||
|
||||
|
||||
List<Measurement> getThermalMetrics() {
|
||||
List<Measurement> getThermalMetrics(int sample) {
|
||||
|
||||
List<Measurement> list = new ArrayList<>();
|
||||
try {
|
||||
|
@ -99,11 +110,11 @@ class SystemEnergy extends Resource {
|
|||
tagsMap.put("servername", managedSystem.name);
|
||||
log.trace("getThermalMetrics() - tags: {}", tagsMap);
|
||||
|
||||
metric.getSample().energyUtil.thermalUtil.cpuTemperatures.forEach((t) -> {
|
||||
metric.getSample(sample).energyUtil.thermalUtil.cpuTemperatures.forEach((t) -> {
|
||||
fieldsMap.put("cpuTemperature_" + t.entityInstance, t.temperatureReading);
|
||||
});
|
||||
|
||||
metric.getSample().energyUtil.thermalUtil.inletTemperatures.forEach((t) -> {
|
||||
metric.getSample(sample).energyUtil.thermalUtil.inletTemperatures.forEach((t) -> {
|
||||
fieldsMap.put("inletTemperature_" + t.entityInstance, t.temperatureReading);
|
||||
});
|
||||
|
||||
|
@ -114,7 +125,7 @@ class SystemEnergy extends Resource {
|
|||
log.trace("getThermalMetrics() - fields: {}", fieldsMap);
|
||||
|
||||
|
||||
list.add(new Measurement(tagsMap, fieldsMap));
|
||||
list.add(new Measurement(getTimestamp(sample), tagsMap, fieldsMap));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("getThermalMetrics() - error: {}", e.getMessage());
|
||||
|
|
|
@ -8,12 +8,12 @@ import java.util.List;
|
|||
public final class SampleInfo {
|
||||
|
||||
@JsonProperty("timeStamp")
|
||||
public String timestamp ;
|
||||
public String timestamp;
|
||||
public String getTimeStamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public Integer status ;
|
||||
public Integer status;
|
||||
|
||||
@JsonProperty("errorInfo")
|
||||
public List<ErrorInfo> errors;
|
||||
|
|
|
@ -17,6 +17,10 @@ public final class SystemUtil {
|
|||
@JsonProperty("utilSamples")
|
||||
public List<UtilSample> samples;
|
||||
|
||||
public UtilSample getSample(int n) {
|
||||
return samples.size() > n ? samples.get(n) : new UtilSample();
|
||||
}
|
||||
|
||||
public UtilSample getSample() {
|
||||
return samples.size() > 0 ? samples.get(0) : new UtilSample();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ class LogicalPartitionTest extends Specification {
|
|||
@Shared
|
||||
private RestClient serviceClient
|
||||
|
||||
@Shared
|
||||
private InfluxClient influxClient
|
||||
|
||||
@Shared
|
||||
private ManagedSystem managedSystem
|
||||
|
||||
|
@ -39,7 +42,7 @@ class LogicalPartitionTest extends Specification {
|
|||
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 = new ManagedSystem(serviceClient, influxClient, 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()
|
||||
|
@ -77,6 +80,7 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
then:
|
||||
logicalPartition.metric != null
|
||||
logicalPartition.metric.samples.size() == 6;
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,9 +89,9 @@ class LogicalPartitionTest extends Specification {
|
|||
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
|
||||
logicalPartition.metric.getSample().lparsUtil.memory.logicalMem == 16384.000
|
||||
logicalPartition.metric.getSample().lparsUtil.processor.utilizedProcUnits == 0.00793
|
||||
logicalPartition.metric.getSample().lparsUtil.network.virtualEthernetAdapters.first().receivedBytes == 54.0
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,15 +99,13 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getDetails()
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getDetails(0)
|
||||
|
||||
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'] == 'rhel8-ocp-helper'
|
||||
|
||||
listOfMeasurements.first().fields['osType'] == 'IBM i'
|
||||
listOfMeasurements.first().fields['type'] == 'IBMi'
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,11 +113,11 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getMemoryMetrics()
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getMemoryMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
listOfMeasurements.first().fields['logicalMem'] == 8192.000
|
||||
listOfMeasurements.first().fields['logicalMem'] == 16384.0
|
||||
listOfMeasurements.first().tags['lparname'] == 'rhel8-ocp-helper'
|
||||
|
||||
}
|
||||
|
@ -125,11 +127,11 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getProcessorMetrics()
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getProcessorMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
listOfMeasurements.first().fields['utilizedProcUnits'] == 0.001
|
||||
listOfMeasurements.first().fields['utilizedProcUnits'] == 0.00793
|
||||
listOfMeasurements.first().tags['lparname'] == 'rhel8-ocp-helper'
|
||||
|
||||
}
|
||||
|
@ -139,12 +141,12 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getVirtualEthernetAdapterMetrics()
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getVirtualEthernetAdapterMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
listOfMeasurements.first().fields['receivedBytes'] == 276.467
|
||||
listOfMeasurements.first().tags['location'] == 'U9009.42A.21F64EV-V13-C32'
|
||||
listOfMeasurements.first().fields['receivedBytes'] == 54.0
|
||||
listOfMeasurements.first().tags['location'] == 'U9009.42A.21F64EV-V11-C7'
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,25 +154,13 @@ class LogicalPartitionTest extends Specification {
|
|||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getVirtualFibreChannelAdapterMetrics()
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getVirtualFibreChannelAdapterMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 4
|
||||
listOfMeasurements.first().fields['writeBytes'] == 6690.133
|
||||
listOfMeasurements.size() == 2
|
||||
listOfMeasurements.first().fields['writeBytes'] == 4454.4
|
||||
listOfMeasurements.first().tags['viosId'] == '1'
|
||||
|
||||
}
|
||||
|
||||
|
||||
void "test getVirtualGenericAdapterMetrics"() {
|
||||
|
||||
when:
|
||||
logicalPartition.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = logicalPartition.getVirtualGenericAdapterMetrics()
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
listOfMeasurements.first().fields['readBytes'] == 0.0
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ class ManagedSystemTest extends Specification {
|
|||
@Shared
|
||||
private RestClient serviceClient
|
||||
|
||||
@Shared
|
||||
private InfluxClient influxClient
|
||||
|
||||
@Shared
|
||||
private ManagedSystem managedSystem
|
||||
|
||||
|
@ -33,7 +36,7 @@ class ManagedSystemTest extends Specification {
|
|||
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 = new ManagedSystem(serviceClient, influxClient, 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())
|
||||
}
|
||||
|
@ -55,7 +58,7 @@ class ManagedSystemTest extends Specification {
|
|||
|
||||
when:
|
||||
managedSystem.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = managedSystem.getDetails()
|
||||
List<Measurement> listOfMeasurements = managedSystem.getDetails(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
|
@ -68,7 +71,7 @@ class ManagedSystemTest extends Specification {
|
|||
|
||||
when:
|
||||
managedSystem.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = managedSystem.getMemoryMetrics()
|
||||
List<Measurement> listOfMeasurements = managedSystem.getMemoryMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
|
@ -79,7 +82,7 @@ class ManagedSystemTest extends Specification {
|
|||
|
||||
when:
|
||||
managedSystem.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = managedSystem.getProcessorMetrics()
|
||||
List<Measurement> listOfMeasurements = managedSystem.getProcessorMetrics(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
|
@ -90,7 +93,7 @@ class ManagedSystemTest extends Specification {
|
|||
|
||||
when:
|
||||
managedSystem.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = managedSystem.getSharedProcessorPools()
|
||||
List<Measurement> listOfMeasurements = managedSystem.getSharedProcessorPools(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 4
|
||||
|
@ -100,7 +103,7 @@ class ManagedSystemTest extends Specification {
|
|||
void "test getPhysicalProcessorPool"() {
|
||||
when:
|
||||
managedSystem.deserialize(metricsFile.getText('UTF-8'))
|
||||
List<Measurement> listOfMeasurements = managedSystem.getPhysicalProcessorPool()
|
||||
List<Measurement> listOfMeasurements = managedSystem.getPhysicalProcessorPool(0)
|
||||
|
||||
then:
|
||||
listOfMeasurements.size() == 1
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue