diff --git a/README.md b/README.md index 69f6021..9eb7d9b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ # System Monitor +System monitoring solution with support for plugins. + +![Sysmon Icon](doc/sysmon.png) + This software is free to use and is licensed under the [Apache 2.0 License](LICENSE). - Example dashboards are provided in the [doc/](doc) folder, which can be imported into your Grafana installation. - Screenshots are available in the [downloads](https://bitbucket.org/mnellemann/sysmon/downloads/) section. -![Sysmon Icon](doc/monitoring-eye-320x320.png) ## Components -### Client +### Client / Agent Runs on your hosts and collects metrics, which are sent to the central *server*. diff --git a/client/README.md b/client/README.md index 2d23ac9..db3eabd 100644 --- a/client/README.md +++ b/client/README.md @@ -1,6 +1,6 @@ -# Client +# Client / Agent -This is the client component of SysMon. Install on the hosts for which you want to collect metrics. +This is the client component of SysMon. Install on the hosts where you want to collect metrics. ## Installation diff --git a/doc/sysmon.drawio b/doc/sysmon.drawio new file mode 100644 index 0000000..30c9d63 --- /dev/null +++ b/doc/sysmon.drawio @@ -0,0 +1 @@ +3VjLctowFP0aLzuDJfxaBpK0maHNgkXbVUdY149GtlxZDtCvr4RlwNgQUmDIAAwjnSvJ8jlHurYsPM4WnwUpkq+cArPQgC4sfG8hZA8RsvRvQJc14nu4BmKRUtNoA0zTv2DAgUGrlELZaig5ZzIt2mDI8xxC2cKIEHzebhZx1r5qQWLoANOQsC76PaUyMajtBpvAF0jjxFzaR14dyEjT2NxJmRDK51sQfrDwWHAu61K2GAPT5DW81P0e90TXExOQy2M65Ohnsfz2OIVfo/lfET/Cn4n3yYzySlhlbniS5tXCzFguGxoEr3IKeiTbwqN5kkqYFiTU0bkSXmGJzJgJly8gw8RUopSxMWdcrAbCkaO/Gue53MLrj+4sBX+BrYi7+qiImSoICYu9HNhrZpUlgWcgxVI1MR2QY8Qwbmyq8y1pG72SLVVdgxHjpng98oZwVTCcv4N/1OH/7unHrbJv+2327eG16Xc7VANVy99UuZAJj3lO2MMGHbXF2LSZcF4Y8DdIuTR7GakkPyBQPQF91cOkqknySoRw4GbMxiqJiEEeaDfsF0kAIzJ9bc/j7IzjjuGnyzLjucKmIJS9Lmd+sKkDXp/JA9fD5Ewmd+wdk6Nrm9y7JZMPjzS5c02TDzsmf8ojVi3uRx0p1FNBoYvhkqWKcYHf9vis1mYyWwMkfIlXij1XUg0DjQa1OLbzVlaIwA3DvoVBvWA2GJxnYbjBzsKwuwvD7VkX/qXWhdNRST3DRiQnFnKZ1LyqzciNdemelMmME0FLSy9dl2Rak/pfIXdMEZPm8V51KQ+rbMXTu8U9LFyE9gjnzlznTDuaP3hbuN4d7WLK+R3lnmUCorzVBye8k1PQsQpcLKfYpyeVFt3/kWHOmFSCI5MKvmZSCTqmv4v1nZ7k+R2bUwJ+1LuhuKEPs6g/sZ/mbdT2dtC1ttPjbHQxZzu35Oxmo/jY1m5meWve3j1uWL8AX83cp7/wfiRzNweCH9vc3TO2mzA33jnN6TtMO5O5VXVzTrqKbZ0244d/ \ No newline at end of file diff --git a/doc/sysmon.png b/doc/sysmon.png new file mode 100644 index 0000000..f369e11 Binary files /dev/null and b/doc/sysmon.png differ diff --git a/gradle.properties b/gradle.properties index 7cf4496..8af3aca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -version=0.1.8 -pf4jVersion=3.6.0 -slf4jVersion=1.7.33 -camelVersion=3.14.0 -picocliVersion=4.6.2 -oshiVersion=6.1.1 \ No newline at end of file +version = 0.1.9 +pf4jVersion = 3.6.0 +slf4jVersion = 1.7.33 +camelVersion = 3.14.1 +picocliVersion = 4.6.2 +oshiVersion = 6.1.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..41d9927 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d2880ba..41dfb87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/README.md b/plugins/README.md index 38ebedf..f8b0a83 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -1,6 +1,6 @@ # System Monitor Plugins -Collection of standard sysmon plugins. +Collection of standard sysmon plugins for use with the client. - [base](os-base/) - Base OS metrics (through [oshi](https://github.com/oshi/oshi)) - [aix](os-aix/) - AIX (and Power) specific metrics diff --git a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatExtension.java b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatExtension.java index b797305..1967559 100644 --- a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatExtension.java +++ b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixNetstatExtension.java @@ -1,6 +1,5 @@ package sysmon.plugins.os_aix; -import org.pf4j.Extension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sysmon.shared.Measurement; @@ -47,7 +46,7 @@ public class AixNetstatExtension implements MetricExtension { return false; } - if(!PluginHelper.canExecute("netstat")) { + if(PluginHelper.notExecutable("netstat")) { log.warn("Requires the 'netstat' command."); return false; } diff --git a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorExtension.java b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorExtension.java index 05a43db..ee158a0 100644 --- a/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorExtension.java +++ b/plugins/os-aix/src/main/java/sysmon/plugins/os_aix/AixProcessorExtension.java @@ -47,7 +47,7 @@ public class AixProcessorExtension implements MetricExtension { return false; } - if(!PluginHelper.canExecute("lparstat")) { + if(PluginHelper.notExecutable("lparstat")) { log.warn("Requires the 'lparstat' command."); return false; } diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BasePlugin.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BasePlugin.java index 18eb6e5..864205e 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BasePlugin.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BasePlugin.java @@ -4,7 +4,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.pf4j.Plugin; import org.pf4j.PluginWrapper; -import oshi.PlatformEnum; import oshi.SystemInfo; import oshi.hardware.HardwareAbstractionLayer; diff --git a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatExtension.java b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatExtension.java index 8eba654..996c611 100644 --- a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatExtension.java +++ b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxNetstatExtension.java @@ -1,6 +1,5 @@ package sysmon.plugins.os_linux; -import org.pf4j.Extension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sysmon.shared.Measurement; @@ -47,7 +46,7 @@ public class LinuxNetstatExtension implements MetricExtension { return false; } - if(!PluginHelper.canExecute("netstat")) { + if(PluginHelper.notExecutable("netstat")) { log.warn("Requires the 'netstat' command."); return false; } diff --git a/server/src/main/java/sysmon/server/MetricResultToPointProcessor.java b/server/src/main/java/sysmon/server/MetricResultToPointProcessor.java index 70216f5..5226cfb 100644 --- a/server/src/main/java/sysmon/server/MetricResultToPointProcessor.java +++ b/server/src/main/java/sysmon/server/MetricResultToPointProcessor.java @@ -20,7 +20,7 @@ public class MetricResultToPointProcessor implements Processor { } @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { MetricResult metricResult = exchange.getIn().getBody(MetricResult.class); List measurementList = metricResult.getMeasurements(); diff --git a/server/src/main/java/sysmon/server/ServerRouteBuilder.java b/server/src/main/java/sysmon/server/ServerRouteBuilder.java index 3e50481..694b14a 100644 --- a/server/src/main/java/sysmon/server/ServerRouteBuilder.java +++ b/server/src/main/java/sysmon/server/ServerRouteBuilder.java @@ -10,7 +10,7 @@ import sysmon.shared.ComboResult; public class ServerRouteBuilder extends RouteBuilder { @Override - public void configure() throws Exception { + public void configure() { final Registry registry = getContext().getRegistry(); final String dbname = registry.lookupByNameAndType("dbname", String.class); diff --git a/server/src/main/java/sysmon/server/bean/Hello.java b/server/src/main/java/sysmon/server/bean/Hello.java deleted file mode 100644 index 50f450c..0000000 --- a/server/src/main/java/sysmon/server/bean/Hello.java +++ /dev/null @@ -1,21 +0,0 @@ -package sysmon.server.bean; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Objects; - -public class Hello implements Processor { - - private final static Logger log = LoggerFactory.getLogger(Hello.class); - - public void process(Exchange exchange) throws Exception { - String name = exchange.getIn().getHeader("name", String.class); - String msg = "Hello " + Objects.requireNonNull(name, "universe"); - log.info(msg); - - exchange.getMessage().setBody(msg); - } -} \ No newline at end of file diff --git a/server/src/main/java/sysmon/server/bean/IncomingMetricProcessor.java b/server/src/main/java/sysmon/server/bean/IncomingMetricProcessor.java deleted file mode 100644 index 92501c4..0000000 --- a/server/src/main/java/sysmon/server/bean/IncomingMetricProcessor.java +++ /dev/null @@ -1,18 +0,0 @@ -package sysmon.server.bean; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; - -public class IncomingMetricProcessor implements Processor { - - public void process(Exchange exchange) throws Exception { - - //MetricResult payload = exchange.getIn().getBody(MetricResult.class); - //log.info("I am going to send this data to InfluxDB."); - //log.info(payload.toString()); - - exchange.getMessage().setBody("OK"); - } - - -} diff --git a/shared/src/main/java/sysmon/shared/MetricResult.java b/shared/src/main/java/sysmon/shared/MetricResult.java index 4c64793..3d0d0a3 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.Map; public class MetricResult implements Serializable { diff --git a/shared/src/main/java/sysmon/shared/PluginHelper.java b/shared/src/main/java/sysmon/shared/PluginHelper.java index 6e2ba1d..6c4abde 100644 --- a/shared/src/main/java/sysmon/shared/PluginHelper.java +++ b/shared/src/main/java/sysmon/shared/PluginHelper.java @@ -52,10 +52,10 @@ public class PluginHelper { } - public static boolean canExecute(String cmd) { + public static boolean notExecutable(String cmd) { return Stream.of(System.getenv("PATH").split(Pattern.quote(File.pathSeparator))) .map(Paths::get) - .anyMatch(path -> Files.exists(path.resolve(cmd))); + .noneMatch(path -> Files.exists(path.resolve(cmd))); }