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. **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: Metrics includes:

View file

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

View file

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

View file

@ -153,7 +153,7 @@ class ManagementConsole implements Runnable {
if(xmlFeed.getEntry().getContent().isManagementConsole()) { if(xmlFeed.getEntry().getContent().isManagementConsole()) {
entry = xmlFeed.getEntry().getContent().getManagementConsole(); entry = xmlFeed.getEntry().getContent().getManagementConsole();
log.info("discover() - {}", entry.getName()); //log.info("discover() - {}", entry.getName());
} else { } else {
throw new UnsupportedOperationException("Failed to deserialize ManagementConsole"); 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; private static final long serialVersionUID = 1L;
@JsonProperty("PartitionID")
public Number partitionId;
@JsonProperty("PartitionName") @JsonProperty("PartitionName")
public String partitionName; public String partitionName;

View file

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