From 132619bb51c6615b27ebad11646bcd4a664ffba7 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Sat, 6 Nov 2021 20:32:54 +0100 Subject: [PATCH] Add os details from base (oshi) Add netstat from base (oshi) Update 3rd party dependencies Bump version --- .../sysmon/client/ClientRouteBuilder.java | 4 +- gradle.properties | 6 +- .../plugins/os_aix/AixNetstatExtension.java | 9 ++ .../plugins/os_aix/AixProcessorExtension.java | 9 ++ .../src/test/groovy/AixProcessorTest.groovy | 3 + .../plugins/os_base/BaseDetailsExtension.java | 92 +++++++++++++++ .../plugins/os_base/BaseDiskExtension.java | 9 ++ .../os_base/BaseFilesystemExtension.java | 10 ++ .../plugins/os_base/BaseLoadExtension.java | 9 ++ .../plugins/os_base/BaseMemoryExtension.java | 9 ++ .../plugins/os_base/BaseNetstatExtension.java | 106 ++++++++++++++++++ .../plugins/os_base/BaseNetworkExtension.java | 9 ++ .../plugins/os_base/BaseProcessExtension.java | 9 ++ .../os_base/BaseProcessorExtension.java | 9 ++ .../sysmon/plugins/os_ibmi/TestExtension.java | 9 ++ .../os_linux/LinuxNetstatExtension.java | 9 ++ .../os_linux/LinuxSockstatExtension.java | 12 +- .../java/sysmon/shared/MetricExtension.java | 1 + 18 files changed, 318 insertions(+), 6 deletions(-) create mode 100644 plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDetailsExtension.java create mode 100644 plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetstatExtension.java diff --git a/client/src/main/java/sysmon/client/ClientRouteBuilder.java b/client/src/main/java/sysmon/client/ClientRouteBuilder.java index 7353b57..7c98785 100644 --- a/client/src/main/java/sysmon/client/ClientRouteBuilder.java +++ b/client/src/main/java/sysmon/client/ClientRouteBuilder.java @@ -60,8 +60,8 @@ public class ClientRouteBuilder extends RouteBuilder { // Setup Camel route for this extension // a unique timer name gives the timer it's own thread, otherwise it's a shared thread for other timers with same name. - //from("timer:extensions?fixedRate=true&period=30s") - from("timer:"+provides+"?fixedRate=true&period=30s") + String timerName = ext.isThreaded() ? ext.getProvides() : "default"; + from("timer:"+timerName+"?fixedRate=true&period=30s") .bean(ext, "getMetrics") .outputType(MetricResult.class) .process(new MetricEnrichProcessor(registry)) diff --git a/gradle.properties b/gradle.properties index e6e8ae6..f44dec5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -version=0.1.5 +version=0.1.6 pf4jVersion=3.6.0 slf4jVersion=1.7.32 -camelVersion=3.11.2 +camelVersion=3.11.3 picocliVersion=4.6.1 -oshiVersion=5.8.2 \ No newline at end of file +oshiVersion=5.8.3 \ No newline at end of file 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 fc7e383..ee29f75 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 @@ -26,6 +26,7 @@ public class AixNetstatExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; @Override @@ -33,6 +34,11 @@ public class AixNetstatExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { @@ -69,6 +75,9 @@ public class AixNetstatExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override 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 c847368..05a43db 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 @@ -25,6 +25,7 @@ public class AixProcessorExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = true; @Override @@ -32,6 +33,11 @@ public class AixProcessorExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { @@ -69,6 +75,9 @@ public class AixProcessorExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-aix/src/test/groovy/AixProcessorTest.groovy b/plugins/os-aix/src/test/groovy/AixProcessorTest.groovy index a71ce58..72a2713 100644 --- a/plugins/os-aix/src/test/groovy/AixProcessorTest.groovy +++ b/plugins/os-aix/src/test/groovy/AixProcessorTest.groovy @@ -18,6 +18,7 @@ class AixProcessorTest extends Specification { stats.getSys() == 3.3f stats.getWait() == 0.0f stats.getIdle() == 13.0f + stats.getFields().get("smt") == 8 stats.getFields().get("ent") == 0.50f stats.getFields().get("type") == "Shared" @@ -37,6 +38,7 @@ class AixProcessorTest extends Specification { stats.getSys() == 0.2f stats.getWait() == 0.0f stats.getIdle() == 99.7f + stats.getFields().get("smt") == 8 stats.getFields().get("physc") == 0.07f stats.getFields().get("type") == "Dedicated" @@ -56,6 +58,7 @@ class AixProcessorTest extends Specification { stats.getSys() == 0.0f stats.getWait() == 0.0f stats.getIdle() == 99.97f + stats.getFields().get("smt") == 8 stats.getFields().get("ent") == 4.00f stats.getFields().get("mode") == "Uncapped" stats.getFields().get("type") == "Shared" diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDetailsExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDetailsExtension.java new file mode 100644 index 0000000..e03640f --- /dev/null +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseDetailsExtension.java @@ -0,0 +1,92 @@ +package sysmon.plugins.os_base; + +import org.pf4j.Extension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import oshi.SystemInfo; +import oshi.hardware.HWDiskStore; +import oshi.hardware.HardwareAbstractionLayer; +import sysmon.shared.Measurement; +import sysmon.shared.MetricExtension; +import sysmon.shared.MetricResult; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Extension +public class BaseDetailsExtension implements MetricExtension { + + private static final Logger log = LoggerFactory.getLogger(BaseDetailsExtension.class); + + // Extension details + private final String name = "base_details"; + private final String provides = "details"; + private final String description = "Base Details Metrics"; + + // Configuration / Options + private boolean enabled = true; + private boolean threaded = false; + + private SystemInfo systemInfo; + + + @Override + public boolean isEnabled() { + return enabled; + } + + @Override + public boolean isThreaded() { + return threaded; + } + + @Override + public boolean isSupported() { + systemInfo = BasePlugin.getSystemInfo(); + return systemInfo != null; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getProvides() { + return provides; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public void setConfiguration(Map map) { + if (map.containsKey("enabled")) { + enabled = (boolean) map.get("enabled"); + } + if (map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } + } + + @Override + public MetricResult getMetrics() { + + HashMap fieldsMap = new HashMap() {{ + put("family", systemInfo.getOperatingSystem().getFamily()); // Freedesktop.org / AIX + put("manufacturer", systemInfo.getOperatingSystem().getManufacturer()); // GNU/Linux / IBM + put("os_codename", systemInfo.getOperatingSystem().getVersionInfo().getCodeName()); // Flatpak runtime / ppc64 + put("os_version", systemInfo.getOperatingSystem().getVersionInfo().getVersion()); // 21.08.4 / 7.2 + put("os_build", systemInfo.getOperatingSystem().getVersionInfo().getBuildNumber()); // 5.13.0-7620-generic / 2045B_72V + put("uptime", systemInfo.getOperatingSystem().getSystemUptime()); + put("threads", systemInfo.getOperatingSystem().getThreadCount()); + }}; + + return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap)); + } + +} \ No newline at end of file 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 8cb319a..499229e 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 @@ -26,6 +26,7 @@ public class BaseDiskExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private HardwareAbstractionLayer hardwareAbstractionLayer; @@ -35,6 +36,11 @@ public class BaseDiskExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); @@ -61,6 +67,9 @@ public class BaseDiskExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseFilesystemExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseFilesystemExtension.java index 384cf7a..d5996c0 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseFilesystemExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseFilesystemExtension.java @@ -27,6 +27,7 @@ public class BaseFilesystemExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private List excludeType = new ArrayList() {{ add("tmpfs"); add("ahafs"); @@ -44,6 +45,11 @@ public class BaseFilesystemExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { systemInfo = BasePlugin.getSystemInfo(); @@ -72,6 +78,10 @@ public class BaseFilesystemExtension implements MetricExtension { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } + if(map.containsKey("exclude_type")) { excludeType = (List) map.get("exclude_type"); } diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java index 545ad4b..b49ce60 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseLoadExtension.java @@ -23,6 +23,7 @@ public class BaseLoadExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private HardwareAbstractionLayer hardwareAbstractionLayer; @@ -31,6 +32,11 @@ public class BaseLoadExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); @@ -57,6 +63,9 @@ public class BaseLoadExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseMemoryExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseMemoryExtension.java index b960099..dd5b694 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseMemoryExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseMemoryExtension.java @@ -23,6 +23,7 @@ public class BaseMemoryExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private HardwareAbstractionLayer hardwareAbstractionLayer; @@ -32,6 +33,11 @@ public class BaseMemoryExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); @@ -58,6 +64,9 @@ public class BaseMemoryExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetstatExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetstatExtension.java new file mode 100644 index 0000000..3f57f33 --- /dev/null +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseNetstatExtension.java @@ -0,0 +1,106 @@ +package sysmon.plugins.os_base; + +import org.pf4j.Extension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import oshi.SystemInfo; +import oshi.hardware.HWDiskStore; +import oshi.hardware.HardwareAbstractionLayer; +import sysmon.shared.Measurement; +import sysmon.shared.MetricExtension; +import sysmon.shared.MetricResult; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Extension +public class BaseNetstatExtension implements MetricExtension { + + private static final Logger log = LoggerFactory.getLogger(BaseNetstatExtension.class); + + // Extension details + private final String name = "base_netstat"; + private final String provides = "netstat"; + private final String description = "Base Netstat Metrics"; + + // Configuration / Options + private boolean enabled = true; + private boolean threaded = false; + + private SystemInfo systemInfo; + + + @Override + public boolean isEnabled() { + return enabled; + } + + @Override + public boolean isThreaded() { + return threaded; + } + + @Override + public boolean isSupported() { + systemInfo = BasePlugin.getSystemInfo(); + return systemInfo != null; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getProvides() { + return provides; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public void setConfiguration(Map map) { + if (map.containsKey("enabled")) { + enabled = (boolean) map.get("enabled"); + } + if (map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } + } + + @Override + public MetricResult getMetrics() { + + HashMap fieldsMap = new HashMap() {{ + + put("tcp4_conn_active", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv4Stats().getConnectionsActive()); + put("tcp4_conn_passive", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv4Stats().getConnectionsPassive()); + put("tcp4_conn_established", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv4Stats().getConnectionsEstablished()); + put("tcp4_conn_failures", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv4Stats().getConnectionFailures()); + put("tcp4_conn_reset", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv4Stats().getConnectionsReset()); + + put("tcp6_conn_active", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv6Stats().getConnectionsActive()); + put("tcp6_conn_passive", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv6Stats().getConnectionsPassive()); + put("tcp6_conn_established", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv6Stats().getConnectionsEstablished()); + put("tcp6_conn_failures", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv6Stats().getConnectionFailures()); + put("tcp6_conn_reset", systemInfo.getOperatingSystem().getInternetProtocolStats().getTCPv6Stats().getConnectionsReset()); + + put("udp4_data_sent", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv4Stats().getDatagramsSent()); + put("udp4_data_recv", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv4Stats().getDatagramsReceived()); + put("udp4_data_recv_error", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv4Stats().getDatagramsReceivedErrors()); + + put("udp6_data_sent", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv6Stats().getDatagramsSent()); + put("udp6_data_recv", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv6Stats().getDatagramsReceived()); + put("udp6_data_recv_error", systemInfo.getOperatingSystem().getInternetProtocolStats().getUDPv6Stats().getDatagramsReceivedErrors()); + + }}; + + return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap)); + } + +} \ No newline at end of file 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 3380851..f4a7a05 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 @@ -26,6 +26,7 @@ public class BaseNetworkExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private HardwareAbstractionLayer hardwareAbstractionLayer; @@ -35,6 +36,11 @@ public class BaseNetworkExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); @@ -61,6 +67,9 @@ public class BaseNetworkExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessExtension.java index 4ada212..6d2329e 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessExtension.java @@ -23,6 +23,7 @@ public class BaseProcessExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private List includeList = new ArrayList() {{ add("java"); add("mysqld"); @@ -39,6 +40,11 @@ public class BaseProcessExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { systemInfo = BasePlugin.getSystemInfo(); @@ -65,6 +71,9 @@ public class BaseProcessExtension implements MetricExtension { if(map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } if(map.containsKey("include")) { includeList = (List) map.get("include"); } diff --git a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessorExtension.java b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessorExtension.java index 3127c5f..69bbed2 100644 --- a/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessorExtension.java +++ b/plugins/os-base/src/main/java/sysmon/plugins/os_base/BaseProcessorExtension.java @@ -24,6 +24,7 @@ public class BaseProcessorExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private HardwareAbstractionLayer hardwareAbstractionLayer; private long[] oldTicks; @@ -33,6 +34,11 @@ public class BaseProcessorExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { hardwareAbstractionLayer = BasePlugin.getHardwareAbstractionLayer(); @@ -59,6 +65,9 @@ public class BaseProcessorExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-ibmi/src/main/java/sysmon/plugins/os_ibmi/TestExtension.java b/plugins/os-ibmi/src/main/java/sysmon/plugins/os_ibmi/TestExtension.java index 6978d92..01aff11 100644 --- a/plugins/os-ibmi/src/main/java/sysmon/plugins/os_ibmi/TestExtension.java +++ b/plugins/os-ibmi/src/main/java/sysmon/plugins/os_ibmi/TestExtension.java @@ -23,6 +23,7 @@ public class TestExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; private AS400 as400; private SystemStatus systemStatus; @@ -33,6 +34,11 @@ public class TestExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { @@ -80,6 +86,9 @@ public class TestExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override 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 8fb4cd5..8eba654 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 @@ -26,6 +26,7 @@ public class LinuxNetstatExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; @Override @@ -33,6 +34,11 @@ public class LinuxNetstatExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { @@ -69,6 +75,9 @@ public class LinuxNetstatExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxSockstatExtension.java b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxSockstatExtension.java index 29acc79..14af318 100644 --- a/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxSockstatExtension.java +++ b/plugins/os-linux/src/main/java/sysmon/plugins/os_linux/LinuxSockstatExtension.java @@ -12,7 +12,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@Extension +// Disabled +//@Extension public class LinuxSockstatExtension implements MetricExtension { private static final Logger log = LoggerFactory.getLogger(LinuxSockstatExtension.class); @@ -24,6 +25,7 @@ public class LinuxSockstatExtension implements MetricExtension { // Configuration / Options private boolean enabled = true; + private boolean threaded = false; @Override @@ -31,6 +33,11 @@ public class LinuxSockstatExtension implements MetricExtension { return enabled; } + @Override + public boolean isThreaded() { + return threaded; + } + @Override public boolean isSupported() { @@ -62,6 +69,9 @@ public class LinuxSockstatExtension implements MetricExtension { if (map.containsKey("enabled")) { enabled = (boolean) map.get("enabled"); } + if(map.containsKey("threaded")) { + threaded = (boolean) map.get("threaded"); + } } @Override diff --git a/shared/src/main/java/sysmon/shared/MetricExtension.java b/shared/src/main/java/sysmon/shared/MetricExtension.java index 3249cf1..e5ae3a7 100644 --- a/shared/src/main/java/sysmon/shared/MetricExtension.java +++ b/shared/src/main/java/sysmon/shared/MetricExtension.java @@ -7,6 +7,7 @@ import java.util.Map; public interface MetricExtension extends ExtensionPoint { boolean isEnabled(); + boolean isThreaded(); boolean isSupported(); String getName();