Remove transmittedBytes from lpar generic adapter metrics, as value is always null.

This commit is contained in:
Mark Nellemann 2021-06-10 12:31:44 +02:00
parent 74eead0046
commit a24401aa8a
5 changed files with 31 additions and 15 deletions

View file

@ -12,7 +12,7 @@ systemctl enable hmci.service
systemctl restart hmci.service systemctl restart hmci.service
``` ```
To read log output from the service, use: To read log output from the service:
```shell ```shell
journalctl -f -u hmci.service journalctl -f -u hmci.service

View file

@ -249,7 +249,7 @@ public class HmcRestClient {
// Do not try to parse empty response // Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) { if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++; responseErrors++;
log.warn("getPcmDataForManagedSystem() - empty response"); log.warn("getPcmDataForManagedSystem() - empty response, skipping: " + system.name);
return null; return null;
} }
@ -287,7 +287,7 @@ public class HmcRestClient {
// Do not try to parse empty response // Do not try to parse empty response
if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) { if(responseBody == null || responseBody.isEmpty() || responseBody.length() <= 1) {
responseErrors++; responseErrors++;
log.warn("getPcmDataForLogicalPartition() - empty response"); log.warn("getPcmDataForLogicalPartition() - empty response, skipping: " + partition.name);
return null; return null;
} }

View file

@ -122,13 +122,13 @@ class InfluxClient {
void writeManagedSystem(ManagedSystem system) { void writeManagedSystem(ManagedSystem system) {
if(system.metrics == null) { if(system.metrics == null) {
log.trace("writeManagedSystem() - null metrics, skipping"); log.trace("writeManagedSystem() - null metrics, skipping: " + system.name);
return; return;
} }
Instant timestamp = system.getTimestamp(); Instant timestamp = system.getTimestamp();
if(timestamp == null) { if(timestamp == null) {
log.warn("writeManagedSystem() - no timestamp, skipping"); log.warn("writeManagedSystem() - no timestamp, skipping: " + system.name);
return; return;
} }
@ -253,13 +253,13 @@ class InfluxClient {
void writeLogicalPartition(LogicalPartition partition) { void writeLogicalPartition(LogicalPartition partition) {
if(partition.metrics == null) { if(partition.metrics == null) {
log.warn("writeLogicalPartition() - null metrics, skipping"); log.warn("writeLogicalPartition() - null metrics, skipping: " + partition.name);
return; return;
} }
Instant timestamp = partition.getTimestamp(); Instant timestamp = partition.getTimestamp();
if(timestamp == null) { if(timestamp == null) {
log.warn("writeLogicalPartition() - no timestamp, skipping"); log.warn("writeLogicalPartition() - no timestamp, skipping: " + partition.name);
return; return;
} }
@ -311,21 +311,21 @@ class InfluxClient {
*/ */
void writeSystemEnergy(SystemEnergy system) { void writeSystemEnergy(SystemEnergy systemEnergy) {
if(system.metrics == null) { if(systemEnergy.metrics == null) {
log.trace("writeSystemEnergy() - null metrics, skipping"); log.trace("writeSystemEnergy() - null metrics, skipping: " + systemEnergy.system.name);
return; return;
} }
Instant timestamp = system.getTimestamp(); Instant timestamp = systemEnergy.getTimestamp();
if(timestamp == null) { if(timestamp == null) {
log.warn("writeSystemEnergy() - no timestamp, skipping"); log.warn("writeSystemEnergy() - no timestamp, skipping: " + systemEnergy.system.name);
return; return;
} }
getSystemEnergyPower(system, timestamp).forEach(it -> batchPoints.point(it) ); getSystemEnergyPower(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(system, timestamp).forEach(it -> batchPoints.point(it) ); getSystemEnergyTemperature(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
} }
private static List<Point> getSystemEnergyPower(SystemEnergy system, Instant timestamp) { private static List<Point> getSystemEnergyPower(SystemEnergy system, Instant timestamp) {

View file

@ -181,7 +181,6 @@ class LogicalPartition extends MetaSystem {
fieldsMap.put("numOfWrites", adapter.numOfWrites); fieldsMap.put("numOfWrites", adapter.numOfWrites);
fieldsMap.put("writeBytes", adapter.writeBytes); fieldsMap.put("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes); fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type); fieldsMap.put("type", adapter.type);
log.trace("getVirtualGenericAdapterMetrics() - fields: " + fieldsMap.toString()); log.trace("getVirtualGenericAdapterMetrics() - fields: " + fieldsMap.toString());

View file

@ -122,4 +122,21 @@ class LogicalPartitionTest extends Specification {
} }
void "test getVirtualGenericAdapterMetrics"() {
setup:
def testFile = new File(getClass().getResource('/pcm-data-logical-partition.json').toURI())
def testJson = testFile.getText('UTF-8')
ManagedSystem system = new ManagedSystem("e09834d1-c930-3883-bdad-405d8e26e166", "Test Name","Test Type", "Test Model", "Test S/N")
LogicalPartition lpar = new LogicalPartition("2DE05DB6-8AD5-448F-8327-0F488D287E82", "9Flash01", "OS400", system)
when:
lpar.processMetrics(testJson)
List<Measurement> listOfMeasurements = lpar.getVirtualGenericAdapterMetrics()
then:
listOfMeasurements.size() == 1
listOfMeasurements.first().fields['readBytes'] == 0.0
}
} }