Refactored package names.
This commit is contained in:
parent
b6cae0da9e
commit
1b60d58df3
|
@ -1,6 +1,6 @@
|
||||||
# System Monitor / System Observer
|
# System Monitor
|
||||||
|
|
||||||
... or some better name.
|
Java based system monitoring solution with support for plugins.
|
||||||
|
|
||||||
|
|
||||||
## Client
|
## Client
|
||||||
|
|
12
build.gradle
12
build.gradle
|
@ -1,9 +1,19 @@
|
||||||
subprojects {
|
subprojects {
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url("https://plugins.gradle.org/m2/") }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'org.redline-rpm:redline:1.2.9'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'groovy'
|
apply plugin: 'groovy'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'org.spockframework:spock-core:2.0-M5-groovy-3.0'
|
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
|
||||||
testImplementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
testImplementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
||||||
|
|
||||||
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
||||||
|
|
|
@ -32,7 +32,7 @@ def projectName = "sysmon-client"
|
||||||
|
|
||||||
application {
|
application {
|
||||||
// Define the main class for the application.
|
// Define the main class for the application.
|
||||||
mainClassName = 'org.sysmon.client.Application'
|
mainClass.set('sysmon.client.Application')
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
run {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This Java source file was generated by the Gradle 'init' task.
|
* This Java source file was generated by the Gradle 'init' task.
|
||||||
*/
|
*/
|
||||||
package org.sysmon.client;
|
package sysmon.client;
|
||||||
|
|
||||||
import org.apache.camel.main.Main;
|
import org.apache.camel.main.Main;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -12,8 +12,6 @@ import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@CommandLine.Command(name = "sysmon-client", mixinStandardHelpOptions = true)
|
@CommandLine.Command(name = "sysmon-client", mixinStandardHelpOptions = true)
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.client;
|
package sysmon.client;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
import org.apache.camel.builder.RouteBuilder;
|
||||||
|
@ -8,8 +8,8 @@ import org.pf4j.JarPluginManager;
|
||||||
import org.pf4j.PluginManager;
|
import org.pf4j.PluginManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
|
@ -1,9 +1,9 @@
|
||||||
package org.sysmon.client;
|
package sysmon.client;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
import org.apache.camel.spi.Registry;
|
import org.apache.camel.spi.Registry;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
|
|
||||||
public class MetricEnrichProcessor implements Processor {
|
public class MetricEnrichProcessor implements Processor {
|
|
@ -1,9 +1,7 @@
|
||||||
package org.sysmon.client
|
package sysmon.client
|
||||||
|
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class AppTest extends Specification {
|
class AppTest extends Specification {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
group=org.sysmon
|
|
||||||
version=0.0.1-SNAPSHOT
|
version=0.0.1-SNAPSHOT
|
||||||
|
|
||||||
pf4jVersion=3.6.0
|
pf4jVersion=3.6.0
|
||||||
slf4jVersion=1.7.30
|
slf4jVersion=1.7.30
|
||||||
camelVersion=3.7.4
|
camelVersion=3.7.4
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -10,7 +10,7 @@ subprojects {
|
||||||
apply plugin: 'groovy'
|
apply plugin: 'groovy'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'org.spockframework:spock-core:2.0-M5-groovy-3.0'
|
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
|
||||||
testImplementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
testImplementation "org.slf4j:slf4j-api:${slf4jVersion}"
|
||||||
testImplementation project(':shared')
|
testImplementation project(':shared')
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pluginId=sysmon-aix
|
pluginId=sysmon-aix
|
||||||
pluginClass=org.sysmon.plugins.sysmon_aix.AixPlugin
|
pluginClass=sysmon.plugins.os_aix.AixPlugin
|
||||||
pluginVersion=0.0.1
|
pluginVersion=0.0.1
|
||||||
pluginProvider=System Monitor
|
pluginProvider=System Monitor
|
||||||
pluginDependencies=
|
pluginDependencies=
|
|
@ -1,12 +1,12 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
import org.sysmon.shared.PluginHelper;
|
import sysmon.shared.PluginHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -22,8 +22,8 @@ public class AixDiskStat {
|
||||||
//private Float tmAct = 0.0f; // Indicates the percentage of time the physical disk/tape was active (bandwidth utilization for the drive).
|
//private Float tmAct = 0.0f; // Indicates the percentage of time the physical disk/tape was active (bandwidth utilization for the drive).
|
||||||
private Float kbps = 0.0f; // Indicates the amount of data transferred (read or written) to the drive in KB per second.
|
private Float kbps = 0.0f; // Indicates the amount of data transferred (read or written) to the drive in KB per second.
|
||||||
private Float tps = 0.0f; // Indicates the number of transfers per second that were issued to the physical disk/tape. A transfer is an I/O request to the physical disk/tape. Multiple logical requests can be combined into a single I/O request to the disk. A transfer is of indeterminate size.
|
private Float tps = 0.0f; // Indicates the number of transfers per second that were issued to the physical disk/tape. A transfer is an I/O request to the physical disk/tape. Multiple logical requests can be combined into a single I/O request to the disk. A transfer is of indeterminate size.
|
||||||
private Long kbRead = 0l; // The total number of KB read.
|
private Long kbRead = 0L; // The total number of KB read.
|
||||||
private Long kbWritten = 0l; // The total number of KB written.
|
private Long kbWritten = 0L; // The total number of KB written.
|
||||||
|
|
||||||
|
|
||||||
AixDiskStat(List<String> lines) {
|
AixDiskStat(List<String> lines) {
|
||||||
|
@ -56,6 +56,8 @@ public class AixDiskStat {
|
||||||
Map<String, Object> fields = new HashMap<>();
|
Map<String, Object> fields = new HashMap<>();
|
||||||
fields.put("reads", kbRead * 1024); // from Kb to bytes
|
fields.put("reads", kbRead * 1024); // from Kb to bytes
|
||||||
fields.put("writes", kbWritten * 1024); // from Kb to bytes
|
fields.put("writes", kbWritten * 1024); // from Kb to bytes
|
||||||
|
fields.put("kbps", kbps);
|
||||||
|
fields.put("tps", tps);
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
import org.sysmon.shared.PluginHelper;
|
import sysmon.shared.PluginHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -1,12 +1,12 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
import org.sysmon.shared.PluginHelper;
|
import sysmon.shared.PluginHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_aix;
|
package sysmon.plugins.os_aix;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -118,8 +118,6 @@ public class AixProcessorStat {
|
||||||
|
|
||||||
public Map<String, String> getTags() {
|
public Map<String, String> getTags() {
|
||||||
Map<String, String> tags = new HashMap<>();
|
Map<String, String> tags = new HashMap<>();
|
||||||
tags.put("mode", mode);
|
|
||||||
tags.put("type", type);
|
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +132,8 @@ public class AixProcessorStat {
|
||||||
fields.put("physc", physc);
|
fields.put("physc", physc);
|
||||||
fields.put("entc", entc);
|
fields.put("entc", entc);
|
||||||
fields.put("lbusy", lbusy);
|
fields.put("lbusy", lbusy);
|
||||||
|
fields.put("mode", mode);
|
||||||
|
fields.put("type", type);
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import org.sysmon.plugins.sysmon_aix.AixDiskExtension
|
import sysmon.plugins.os_aix.AixDiskExtension
|
||||||
import org.sysmon.plugins.sysmon_aix.AixDiskStat
|
import sysmon.plugins.os_aix.AixDiskStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class AixDiskTest extends Specification {
|
class AixDiskTest extends Specification {
|
||||||
|
@ -16,8 +16,10 @@ class AixDiskTest extends Specification {
|
||||||
|
|
||||||
then:
|
then:
|
||||||
//stats.getTags().get("device") == "hdisk0"
|
//stats.getTags().get("device") == "hdisk0"
|
||||||
stats.getFields().get("reads") == 757760l
|
stats.getFields().get("reads") == 757760L
|
||||||
stats.getFields().get("writes") == 12288l
|
stats.getFields().get("writes") == 12288L
|
||||||
|
stats.getFields().get("kbps") == 752.0F
|
||||||
|
stats.getFields().get("tps") == 81.0F
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import org.sysmon.plugins.sysmon_aix.AixMemoryExtension
|
import sysmon.plugins.os_aix.AixMemoryExtension
|
||||||
import org.sysmon.plugins.sysmon_aix.AixMemoryStat
|
import sysmon.plugins.os_aix.AixMemoryStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class AixMemoryTest extends Specification {
|
class AixMemoryTest extends Specification {
|
|
@ -1,5 +1,5 @@
|
||||||
import org.sysmon.plugins.sysmon_aix.AixProcessorExtension
|
import sysmon.plugins.os_aix.AixProcessorExtension
|
||||||
import org.sysmon.plugins.sysmon_aix.AixProcessorStat
|
import sysmon.plugins.os_aix.AixProcessorStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class AixProcessorTest extends Specification {
|
class AixProcessorTest extends Specification {
|
||||||
|
@ -40,8 +40,8 @@ class AixProcessorTest extends Specification {
|
||||||
stats.getWait() == 0.0f
|
stats.getWait() == 0.0f
|
||||||
stats.getIdle() == 99.97f
|
stats.getIdle() == 99.97f
|
||||||
stats.getFields().get("ent") == 4.00f
|
stats.getFields().get("ent") == 4.00f
|
||||||
stats.getTags().get("mode") == "Uncapped"
|
stats.getFields().get("mode") == "Uncapped"
|
||||||
stats.getTags().get("type") == "Shared"
|
stats.getFields().get("type") == "Shared"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pluginId=sysmon-linux
|
pluginId=sysmon-linux
|
||||||
pluginClass=org.sysmon.plugins.sysmon_linux.LinuxPlugin
|
pluginClass=sysmon.plugins.os_linux.LinuxPlugin
|
||||||
pluginVersion=0.0.1
|
pluginVersion=0.0.1
|
||||||
pluginProvider=System Monitor
|
pluginProvider=System Monitor
|
||||||
pluginDependencies=
|
pluginDependencies=
|
|
@ -1,11 +1,11 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -49,25 +49,25 @@ public class LinuxDiskProcLine {
|
||||||
== =====================================
|
== =====================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Long readsCompleted = 0l; // successfully
|
private Long readsCompleted = 0L; // successfully
|
||||||
private Long readsMerged = 0l;
|
//private Long readsMerged = 0L;
|
||||||
private Long sectorsRead = 0l; // 512 bytes pr. sector
|
private Long sectorsRead = 0L; // 512 bytes pr. sector
|
||||||
private Long timeSpentReading = 0l; // ms
|
private Long timeSpentReading = 0L; // ms
|
||||||
private Long writesCompleted = 0l; // successfully
|
private Long writesCompleted = 0L; // successfully
|
||||||
private Long writesMerged = 0l;
|
//private Long writesMerged = 0L;
|
||||||
private Long sectorsWritten = 0l; // 512 bytes pr. sector
|
private Long sectorsWritten = 0L; // 512 bytes pr. sector
|
||||||
private Long timeSpentWriting = 0l; // ms
|
private Long timeSpentWriting = 0L; // ms
|
||||||
private Long ioInProgress = 0l;
|
//private Long ioInProgress = 0L;
|
||||||
private Long timeSpentOnIo = 0l; // ms
|
private Long timeSpentOnIo = 0L; // ms
|
||||||
private Long timeSpentOnIoWeighted = 0l;
|
//private Long timeSpentOnIoWeighted = 0L;
|
||||||
|
|
||||||
private Long discardsCompleted = 0l; // successfully
|
//private Long discardsCompleted = 0L; // successfully
|
||||||
private Long discardsMerged = 0l;
|
//private Long discardsMerged = 0L;
|
||||||
private Long sectorsDiscarded = 0l; // 512 bytes pr. sector
|
//private Long sectorsDiscarded = 0L; // 512 bytes pr. sector
|
||||||
private Long timeSpentDiscarding = 0l; // ms
|
//private Long timeSpentDiscarding = 0L; // ms
|
||||||
|
|
||||||
private Long flushRequestsCompleted = 0l;
|
//private Long flushRequestsCompleted = 0L;
|
||||||
private Long timeSpentFlushing = 0l; // ms
|
//private Long timeSpentFlushing = 0L; // ms
|
||||||
|
|
||||||
|
|
||||||
LinuxDiskProcLine(List<String> procLines) {
|
LinuxDiskProcLine(List<String> procLines) {
|
||||||
|
@ -83,17 +83,18 @@ public class LinuxDiskProcLine {
|
||||||
//this.minor = Integer.parseInt(splitStr[1]);
|
//this.minor = Integer.parseInt(splitStr[1]);
|
||||||
//this.device = splitStr[2];
|
//this.device = splitStr[2];
|
||||||
this.readsCompleted += Long.parseLong(splitStr[3]);
|
this.readsCompleted += Long.parseLong(splitStr[3]);
|
||||||
this.readsMerged += Long.parseLong(splitStr[4]);
|
//this.readsMerged += Long.parseLong(splitStr[4]);
|
||||||
this.sectorsRead += Long.parseLong(splitStr[5]);
|
this.sectorsRead += Long.parseLong(splitStr[5]);
|
||||||
this.timeSpentReading += Long.parseLong(splitStr[6]);
|
this.timeSpentReading += Long.parseLong(splitStr[6]);
|
||||||
this.writesCompleted += Long.parseLong(splitStr[7]);
|
this.writesCompleted += Long.parseLong(splitStr[7]);
|
||||||
this.writesMerged += Long.parseLong(splitStr[8]);
|
//this.writesMerged += Long.parseLong(splitStr[8]);
|
||||||
this.sectorsWritten += Long.parseLong(splitStr[9]);
|
this.sectorsWritten += Long.parseLong(splitStr[9]);
|
||||||
this.timeSpentWriting += Long.parseLong(splitStr[10]);
|
this.timeSpentWriting += Long.parseLong(splitStr[10]);
|
||||||
this.ioInProgress += Long.parseLong(splitStr[11]);
|
//this.ioInProgress += Long.parseLong(splitStr[11]);
|
||||||
this.timeSpentOnIo += Long.parseLong(splitStr[12]);
|
this.timeSpentOnIo += Long.parseLong(splitStr[12]);
|
||||||
this.timeSpentOnIoWeighted += Long.parseLong(splitStr[13]);
|
//this.timeSpentOnIoWeighted += Long.parseLong(splitStr[13]);
|
||||||
|
|
||||||
|
/*
|
||||||
if (splitStr.length >= 18) {
|
if (splitStr.length >= 18) {
|
||||||
this.discardsCompleted += Long.parseLong(splitStr[10]);
|
this.discardsCompleted += Long.parseLong(splitStr[10]);
|
||||||
this.discardsMerged += Long.parseLong(splitStr[11]);
|
this.discardsMerged += Long.parseLong(splitStr[11]);
|
||||||
|
@ -113,6 +114,8 @@ public class LinuxDiskProcLine {
|
||||||
this.flushRequestsCompleted = null;
|
this.flushRequestsCompleted = null;
|
||||||
this.timeSpentFlushing = null;
|
this.timeSpentFlushing = null;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,4 +139,8 @@ public class LinuxDiskProcLine {
|
||||||
return timeSpentWriting;
|
return timeSpentWriting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getTransactions() {
|
||||||
|
return readsCompleted + writesCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -11,18 +11,18 @@ public class LinuxDiskStat {
|
||||||
private static final Logger log = LoggerFactory.getLogger(LinuxDiskStat.class);
|
private static final Logger log = LoggerFactory.getLogger(LinuxDiskStat.class);
|
||||||
|
|
||||||
private String device;
|
private String device;
|
||||||
private Long iotime;
|
private final long iotime;
|
||||||
private Long reads;
|
private final long reads;
|
||||||
private Long writes;
|
private final long writes;
|
||||||
private Long readTime;
|
private final double kbps;
|
||||||
private Long writeTime;
|
private final double tps;
|
||||||
|
|
||||||
LinuxDiskStat(LinuxDiskProcLine proc1, LinuxDiskProcLine proc2) {
|
LinuxDiskStat(LinuxDiskProcLine proc1, LinuxDiskProcLine proc2) {
|
||||||
|
|
||||||
iotime = proc2.getTimeSpentOnIo() - proc1.getTimeSpentOnIo();
|
iotime = proc2.getTimeSpentOnIo() - proc1.getTimeSpentOnIo();
|
||||||
writes = proc2.getBytesWritten() - proc1.getBytesWritten();
|
writes = proc2.getBytesWritten() - proc1.getBytesWritten();
|
||||||
reads = proc2.getBytesRead() - proc1.getBytesRead();
|
reads = proc2.getBytesRead() - proc1.getBytesRead();
|
||||||
|
kbps = ((double) writes + reads) / 1024;
|
||||||
|
tps = proc2.getTransactions() - proc1.getTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getTags() {
|
public Map<String, String> getTags() {
|
||||||
|
@ -35,6 +35,8 @@ public class LinuxDiskStat {
|
||||||
fields.put("iotime", iotime);
|
fields.put("iotime", iotime);
|
||||||
fields.put("writes", writes);
|
fields.put("writes", writes);
|
||||||
fields.put("reads", reads);
|
fields.put("reads", reads);
|
||||||
|
fields.put("kbps", kbps);
|
||||||
|
fields.put("tps", tps);
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
import org.sysmon.shared.PluginHelper;
|
import sysmon.shared.PluginHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
|
@ -1,20 +1,18 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import org.pf4j.Extension;
|
import org.pf4j.Extension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricExtension;
|
import sysmon.shared.MetricExtension;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Extension
|
@Extension
|
||||||
public class LinuxProcessorExtension implements MetricExtension {
|
public class LinuxProcessorExtension implements MetricExtension {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
public class LinuxProcessorProcLine {
|
public class LinuxProcessorProcLine {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.plugins.sysmon_linux;
|
package sysmon.plugins.os_linux;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,6 +1,6 @@
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxDiskExtension
|
import sysmon.plugins.os_linux.LinuxDiskExtension
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxDiskProcLine
|
import sysmon.plugins.os_linux.LinuxDiskProcLine
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxDiskStat
|
import sysmon.plugins.os_linux.LinuxDiskStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class LinuxDiskTest extends Specification {
|
class LinuxDiskTest extends Specification {
|
||||||
|
@ -33,9 +33,11 @@ class LinuxDiskTest extends Specification {
|
||||||
LinuxDiskStat diskStat = new LinuxDiskStat(procLine1, procLine2)
|
LinuxDiskStat diskStat = new LinuxDiskStat(procLine1, procLine2)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
diskStat.getFields().get("iotime") == 180l
|
diskStat.getFields().get("iotime") == 180L
|
||||||
diskStat.getFields().get("writes") == 108371968l
|
diskStat.getFields().get("writes") == 108371968L
|
||||||
diskStat.getFields().get("reads") == 69632l
|
diskStat.getFields().get("reads") == 69632L
|
||||||
|
diskStat.getFields().get("kbps") == 105900.0f
|
||||||
|
diskStat.getFields().get("tps") == 97.0f
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxMemoryExtension
|
import sysmon.plugins.os_linux.LinuxMemoryExtension
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxMemoryStat
|
import sysmon.plugins.os_linux.LinuxMemoryStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class LinuxMemoryTest extends Specification {
|
class LinuxMemoryTest extends Specification {
|
|
@ -1,6 +1,6 @@
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxProcessorExtension
|
import sysmon.plugins.os_linux.LinuxProcessorExtension
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxProcessorProcLine
|
import sysmon.plugins.os_linux.LinuxProcessorProcLine
|
||||||
import org.sysmon.plugins.sysmon_linux.LinuxProcessorStat
|
import sysmon.plugins.os_linux.LinuxProcessorStat
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
class LinuxProcessorTest extends Specification {
|
class LinuxProcessorTest extends Specification {
|
|
@ -28,7 +28,7 @@ def projectName = "sysmon-server"
|
||||||
|
|
||||||
application {
|
application {
|
||||||
// Define the main class for the application.
|
// Define the main class for the application.
|
||||||
mainClassName = 'org.sysmon.server.Application'
|
mainClass.set('sysmon.server.Application')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package org.sysmon.server;
|
package sysmon.server;
|
||||||
|
|
||||||
import org.apache.camel.CamelContext;
|
|
||||||
import org.apache.camel.main.Main;
|
import org.apache.camel.main.Main;
|
||||||
import org.apache.camel.support.DefaultRegistry;
|
|
||||||
import org.apache.camel.support.SimpleRegistry;
|
|
||||||
import org.influxdb.InfluxDB;
|
import org.influxdb.InfluxDB;
|
||||||
import org.influxdb.InfluxDBFactory;
|
import org.influxdb.InfluxDBFactory;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
|
@ -1,15 +1,13 @@
|
||||||
package org.sysmon.server;
|
package sysmon.server;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
import org.influxdb.dto.BatchPoints;
|
|
||||||
import org.influxdb.dto.Point;
|
import org.influxdb.dto.Point;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.sysmon.shared.Measurement;
|
import sysmon.shared.Measurement;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package org.sysmon.server;
|
package sysmon.server;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
import org.apache.camel.builder.RouteBuilder;
|
||||||
import org.apache.camel.model.rest.RestBindingMode;
|
import org.apache.camel.model.rest.RestBindingMode;
|
||||||
import org.apache.camel.spi.Registry;
|
import org.apache.camel.spi.Registry;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class ServerRouteBuilder extends RouteBuilder {
|
public class ServerRouteBuilder extends RouteBuilder {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.server.bean;
|
package sysmon.server.bean;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
|
@ -1,8 +1,8 @@
|
||||||
package org.sysmon.server.bean;
|
package sysmon.server.bean;
|
||||||
|
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
import org.sysmon.shared.MetricResult;
|
import sysmon.shared.MetricResult;
|
||||||
|
|
||||||
public class IncomingMetricProcessor implements Processor {
|
public class IncomingMetricProcessor implements Processor {
|
||||||
|
|
|
@ -39,5 +39,5 @@ camel.main.lightweight = true
|
||||||
# camel.main.auto-startup = false
|
# camel.main.auto-startup = false
|
||||||
|
|
||||||
# configure beans
|
# configure beans
|
||||||
#camel.beans.incomingMetricProcessor = #class:org.sysmon.server.bean.IncomingMetricProcessor
|
#camel.beans.incomingMetricProcessor = #class:IncomingMetricProcessor
|
||||||
#camel.beans.hello = #class:org.sysmon.server.bean.Hello
|
#camel.beans.hello = #class:Hello
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.shared;
|
package sysmon.shared;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.shared;
|
package sysmon.shared;
|
||||||
|
|
||||||
import org.pf4j.ExtensionPoint;
|
import org.pf4j.ExtensionPoint;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.shared;
|
package sysmon.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.sysmon.shared;
|
package sysmon.shared;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
Loading…
Reference in a new issue