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
```
To read log output from the service, use:
To read log output from the service:
```shell
journalctl -f -u hmci.service

View File

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

View File

@ -122,13 +122,13 @@ class InfluxClient {
void writeManagedSystem(ManagedSystem system) {
if(system.metrics == null) {
log.trace("writeManagedSystem() - null metrics, skipping");
log.trace("writeManagedSystem() - null metrics, skipping: " + system.name);
return;
}
Instant timestamp = system.getTimestamp();
if(timestamp == null) {
log.warn("writeManagedSystem() - no timestamp, skipping");
log.warn("writeManagedSystem() - no timestamp, skipping: " + system.name);
return;
}
@ -253,13 +253,13 @@ class InfluxClient {
void writeLogicalPartition(LogicalPartition partition) {
if(partition.metrics == null) {
log.warn("writeLogicalPartition() - null metrics, skipping");
log.warn("writeLogicalPartition() - null metrics, skipping: " + partition.name);
return;
}
Instant timestamp = partition.getTimestamp();
if(timestamp == null) {
log.warn("writeLogicalPartition() - no timestamp, skipping");
log.warn("writeLogicalPartition() - no timestamp, skipping: " + partition.name);
return;
}
@ -311,21 +311,21 @@ class InfluxClient {
*/
void writeSystemEnergy(SystemEnergy system) {
void writeSystemEnergy(SystemEnergy systemEnergy) {
if(system.metrics == null) {
log.trace("writeSystemEnergy() - null metrics, skipping");
if(systemEnergy.metrics == null) {
log.trace("writeSystemEnergy() - null metrics, skipping: " + systemEnergy.system.name);
return;
}
Instant timestamp = system.getTimestamp();
Instant timestamp = systemEnergy.getTimestamp();
if(timestamp == null) {
log.warn("writeSystemEnergy() - no timestamp, skipping");
log.warn("writeSystemEnergy() - no timestamp, skipping: " + systemEnergy.system.name);
return;
}
getSystemEnergyPower(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(system, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyPower(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
getSystemEnergyTemperature(systemEnergy, timestamp).forEach(it -> batchPoints.point(it) );
}
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("writeBytes", adapter.writeBytes);
fieldsMap.put("readBytes", adapter.readBytes);
fieldsMap.put("transmittedBytes", adapter.transmittedBytes);
fieldsMap.put("type", adapter.type);
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
}
}