Improve logging on discovery.

This commit is contained in:
Mark Nellemann 2022-11-28 16:51:29 +01:00
parent 2d13bddde1
commit ce42989f1e
6 changed files with 24 additions and 11 deletions

View File

@ -2,7 +2,7 @@
**HMCi** is a utility that collects metrics from one or more *IBM Power Hardware Management Consoles (HMC)*, without the need to install agents on logical partitions / virtual machines running on the IBM Power systems. The metric data is processed and saved into an InfluxDB time-series database. Grafana is used to visualize the metrics data from InfluxDB through provided dashboards, or your own customized dashboards.
This software is free to use and is licensed under the [Apache 2.0 License](https://bitbucket.org/mnellemann/syslogd/src/master/LICENSE), but is not supported or endorsed by International Business Machines (IBM). There is an optional [companion agent](https://bitbucket.org/mnellemann/sysmon/), which provides more metrics from within AIX and Linux.
This software is free to use and is licensed under the [Apache 2.0 License](https://bitbucket.org/mnellemann/hmci/src/master/LICENSE), but is not supported or endorsed by International Business Machines (IBM). There is an optional [companion agent](https://bitbucket.org/mnellemann/sysmon/), which provides more metrics from within AIX and Linux.
Metrics includes:

View File

@ -86,7 +86,7 @@ class LogicalPartition extends Resource {
if(xmlEntry.getContent().isLogicalPartition()) {
entry = xmlEntry.getContent().getLogicalPartitionEntry();
this.name = entry.getName();
log.info("discover() - {}", entry.getName());
log.info("discover() - [{}] {} ({})", String.format("%2d", entry.partitionId), entry.getName(), entry.operatingSystemType);
} else {
throw new UnsupportedOperationException("Failed to deserialize LogicalPartition");
}

View File

@ -119,6 +119,7 @@ class ManagedSystem extends Resource {
if(xmlEntry.getContent().isManagedSystem()) {
entry = xmlEntry.getContent().getManagedSystemEntry();
this.name = entry.getName();
log.info("discover() - [{}] {} ({})", entry.machineTypeModelAndSerialNumber.getTypeAndModelAndSerialNumber(), entry.getName(), entry.systemFirmware);
} else {
throw new UnsupportedOperationException("Failed to deserialize ManagedSystem");
}
@ -127,14 +128,15 @@ class ManagedSystem extends Resource {
for (Link link : this.entry.getAssociatedLogicalPartitions()) {
LogicalPartition logicalPartition = new LogicalPartition(restClient, link.getHref(), this);
logicalPartition.discover();
// Check exclude / include
if(!excludePartitions.contains(logicalPartition.name) && includePartitions.isEmpty()) {
logicalPartitions.add(logicalPartition);
//log.info("discover() - adding !excluded partition: {}", logicalPartition.name);
} else if(!includePartitions.isEmpty() && includePartitions.contains(logicalPartition.name)) {
logicalPartitions.add(logicalPartition);
//log.info("discover() - adding included partition: {}", logicalPartition.name);
if(Objects.equals(logicalPartition.entry.partitionState, "running")) {
// Check exclude / include
if(!excludePartitions.contains(logicalPartition.name) && includePartitions.isEmpty()) {
logicalPartitions.add(logicalPartition);
//log.info("discover() - adding !excluded partition: {}", logicalPartition.name);
} else if(!includePartitions.isEmpty() && includePartitions.contains(logicalPartition.name)) {
logicalPartitions.add(logicalPartition);
//log.info("discover() - adding included partition: {}", logicalPartition.name);
}
}
}

View File

@ -153,7 +153,7 @@ class ManagementConsole implements Runnable {
if(xmlFeed.getEntry().getContent().isManagementConsole()) {
entry = xmlFeed.getEntry().getContent().getManagementConsole();
log.info("discover() - {}", entry.getName());
//log.info("discover() - {}", entry.getName());
} else {
throw new UnsupportedOperationException("Failed to deserialize ManagementConsole");
}

View File

@ -29,6 +29,9 @@ public class LogicalPartitionEntry implements Serializable, ResourceEntry {
private static final long serialVersionUID = 1L;
@JsonProperty("PartitionID")
public Number partitionId;
@JsonProperty("PartitionName")
public String partitionName;

View File

@ -35,4 +35,12 @@ public class MachineTypeModelAndSerialNumber implements Serializable {
return serialNumber;
}
public String getTypeAndModel() {
return machineType+"-"+model;
}
public String getTypeAndModelAndSerialNumber() {
return machineType+"-"+model+"-"+serialNumber;
}
}