Some cleanup.

This commit is contained in:
Mark Nellemann 2021-09-10 21:58:14 +02:00
parent 710f32e32b
commit 203c5daf3e
14 changed files with 12 additions and 24 deletions

View file

@ -4,7 +4,7 @@ Works on IBM Power VIO (Virtual IO) servers, as well as regular IBM Power AIX in
## Installation
We require Java 8, which should already be installed.
We require Java 8, which should already be installed on AIX, or is available to install.
The RPM packages are *"noarch"* Java bytecode, so we can use the **--ignoreos** option to install:
```shell

View file

@ -2,8 +2,8 @@
Description=Sysmon Client Service
[Service]
TimeoutStartSec=0
Restart=always
TimeoutSec=20
Restart=on-failure
ExecStart=/opt/sysmon/client/bin/client -s http://10.20.30.40:9925/metrics
[Install]

View file

@ -4,8 +4,6 @@
package sysmon.client;
import org.apache.camel.main.Main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;
import java.io.File;
@ -18,8 +16,6 @@ import java.util.concurrent.Callable;
@CommandLine.Command(name = "sysmon-client", mixinStandardHelpOptions = true)
public class Application implements Callable<Integer> {
private static final Logger log = LoggerFactory.getLogger(Application.class);
@CommandLine.Option(names = { "-s", "--server-url" }, description = "Server URL (default: ${DEFAULT-VALUE}).", defaultValue = "http://127.0.0.1:9925/metrics", paramLabel = "<url>")
private URL serverUrl;

View file

@ -1,4 +1,4 @@
version=0.0.9
version=0.0.10
pf4jVersion=3.6.0
slf4jVersion=1.7.32
camelVersion=3.11.1

View file

@ -8,7 +8,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class AixNetstatParser {

View file

@ -8,8 +8,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -86,7 +85,7 @@ public class AixProcessorStat {
}
//String lparstat = lines.get(lines.size() -1);
String[] splitStr = lastLine.trim().split("\\s+");
String[] splitStr = Objects.requireNonNull(lastLine).trim().split("\\s+");
if(type.equalsIgnoreCase("shared") && splitStr.length < 9 ||
type.equalsIgnoreCase("dedicated") && splitStr.length < 8) {
throw new UnsupportedOperationException("lparstat string error: " + lastLine);

View file

@ -76,7 +76,7 @@ public class BaseDiskExtension implements MetricExtension {
List<HWDiskStore> diskStores = hardwareAbstractionLayer.getDiskStores();
for(HWDiskStore store : diskStores) {
String name = store.getName();
if (name.matches("hdisk[0-9]+") || name.matches("/dev/x?[sv]d[a-z]{1}") || name.matches("/dev/nvme[0-9]n[0-9]")) {
if (name.matches("hdisk[0-9]+") || name.matches("/dev/x?[sv]d[a-z]") || name.matches("/dev/nvme[0-9]n[0-9]")) {
log.debug("Using device: " + name);
writeBytes += store.getWriteBytes();
readBytes += store.getReadBytes();

View file

@ -3,7 +3,6 @@ package sysmon.plugins.os_base;
import org.pf4j.Extension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.SystemInfo;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.hardware.NetworkIF;
import sysmon.shared.Measurement;
@ -27,9 +26,9 @@ public class BaseNetworkExtension implements MetricExtension {
// Configuration / Options
private boolean enabled = true;
private HardwareAbstractionLayer hardwareAbstractionLayer;
@Override
public boolean isEnabled() {
return enabled;

View file

@ -8,7 +8,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class LinuxNetstatParser {

View file

@ -5,7 +5,6 @@ import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View file

@ -2,8 +2,10 @@
Description=Sysmon Server Service
[Service]
TimeoutStartSec=0
Restart=always
#User=nobody
#Group=nobody
TimeoutSec=20
Restart=on-failure
ExecStart=/opt/sysmon/server/bin/server
[Install]

View file

@ -2,9 +2,7 @@ package sysmon.server;
import org.apache.camel.main.Main;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBException;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.Query;
import picocli.CommandLine;
import java.io.IOException;

View file

@ -2,8 +2,6 @@ package sysmon.server;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.influxdb.InfluxDbConstants;
import org.apache.camel.component.jackson.JacksonDataFormat;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.spi.Registry;
import sysmon.shared.MetricResult;

View file

@ -3,7 +3,6 @@ package sysmon.shared;
import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class MetricResult implements Serializable {