diff --git a/client/doc/AIX.md b/client/doc/AIX.md index 2bd3c90..cea5076 100644 --- a/client/doc/AIX.md +++ b/client/doc/AIX.md @@ -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 diff --git a/client/doc/sysmon-client.service b/client/doc/sysmon-client.service index 33d62ce..cee5c52 100644 --- a/client/doc/sysmon-client.service +++ b/client/doc/sysmon-client.service @@ -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] diff --git a/client/src/main/java/sysmon/client/Application.java b/client/src/main/java/sysmon/client/Application.java index 07b90fd..4fcad29 100644 --- a/client/src/main/java/sysmon/client/Application.java +++ b/client/src/main/java/sysmon/client/Application.java @@ -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 { - 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 = "") private URL serverUrl; diff --git a/gradle.properties b/gradle.properties index 084a2b6..91b92b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.0.9 +version=0.0.10 pf4jVersion=3.6.0 slf4jVersion=1.7.32 camelVersion=3.11.1 diff --git a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatParser.java b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatParser.java index 21c5ef3..06d5dfc 100644 --- a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatParser.java +++ b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatParser.java @@ -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 { diff --git a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java index c42d801..085bb9f 100644 --- a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java +++ b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorStat.java @@ -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); diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDiskExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDiskExtension.java index 3e78281..1fde4b9 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDiskExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDiskExtension.java @@ -76,7 +76,7 @@ public class BaseDiskExtension implements MetricExtension { List 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(); diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetworkExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetworkExtension.java index 744f459..a8780b6 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetworkExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetworkExtension.java @@ -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; diff --git a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatParser.java b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatParser.java index 876c105..35bf550 100644 --- a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatParser.java +++ b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatParser.java @@ -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 { diff --git a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetworkSockStat.java b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetworkSockStat.java index ae1f77e..8f4c595 100644 --- a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetworkSockStat.java +++ b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetworkSockStat.java @@ -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; diff --git a/server/doc/sysmon-server.service b/server/doc/sysmon-server.service index 54e3c47..805a0a6 100644 --- a/server/doc/sysmon-server.service +++ b/server/doc/sysmon-server.service @@ -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] diff --git a/server/src/main/java/sysmon/server/Application.java b/server/src/main/java/sysmon/server/Application.java index 2328896..450dd76 100644 --- a/server/src/main/java/sysmon/server/Application.java +++ b/server/src/main/java/sysmon/server/Application.java @@ -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; diff --git a/server/src/main/java/sysmon/server/ServerRouteBuilder.java b/server/src/main/java/sysmon/server/ServerRouteBuilder.java index a14084a..985f33d 100644 --- a/server/src/main/java/sysmon/server/ServerRouteBuilder.java +++ b/server/src/main/java/sysmon/server/ServerRouteBuilder.java @@ -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; diff --git a/shared/src/main/java/sysmon/shared/MetricResult.java b/shared/src/main/java/sysmon/shared/MetricResult.java index a4c3b35..eb94c1a 100644 --- a/shared/src/main/java/sysmon/shared/MetricResult.java +++ b/shared/src/main/java/sysmon/shared/MetricResult.java @@ -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 {