commit
905d38cd45
|
@ -1,6 +1,6 @@
|
||||||
version=0.0.11
|
version=0.0.12
|
||||||
pf4jVersion=3.6.0
|
pf4jVersion=3.6.0
|
||||||
slf4jVersion=1.7.32
|
slf4jVersion=1.7.32
|
||||||
camelVersion=3.11.1
|
camelVersion=3.11.2
|
||||||
picocliVersion=4.6.1
|
picocliVersion=4.6.1
|
||||||
oshiVersion=5.8.2
|
oshiVersion=5.8.2
|
|
@ -77,7 +77,7 @@ public class AixProcessorExtension implements MetricExtension {
|
||||||
HashMap<String, String> tagsMap = null;
|
HashMap<String, String> tagsMap = null;
|
||||||
HashMap<String, Object> fieldsMap = null;
|
HashMap<String, Object> fieldsMap = null;
|
||||||
|
|
||||||
try (InputStream buf = PluginHelper.executeCommand("lparstat 5 1")) {
|
try (InputStream buf = PluginHelper.executeCommand("lparstat 3 1")) {
|
||||||
AixProcessorStat processorStat = processCommandOutput(buf);
|
AixProcessorStat processorStat = processCommandOutput(buf);
|
||||||
tagsMap = processorStat.getTags();
|
tagsMap = processorStat.getTags();
|
||||||
fieldsMap = processorStat.getFields();
|
fieldsMap = processorStat.getFields();
|
||||||
|
@ -93,5 +93,4 @@ public class AixProcessorExtension implements MetricExtension {
|
||||||
return new AixProcessorStat(input);
|
return new AixProcessorStat(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,13 @@ public class AixProcessorStat {
|
||||||
private static final Logger log = LoggerFactory.getLogger(AixProcessorStat.class);
|
private static final Logger log = LoggerFactory.getLogger(AixProcessorStat.class);
|
||||||
|
|
||||||
// System configuration: type=Shared mode=Uncapped smt=8 lcpu=8 mem=4096MB psize=19 ent=0.50
|
// System configuration: type=Shared mode=Uncapped smt=8 lcpu=8 mem=4096MB psize=19 ent=0.50
|
||||||
private final Pattern patternAixShared = Pattern.compile("^System configuration: type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+)MB psize=(\\d+) ent=(\\d+\\.?\\d*)");
|
private static final Pattern patternAixShared = Pattern.compile("^System configuration: type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+)MB psize=(\\d+) ent=(\\d+\\.?\\d*)");
|
||||||
|
|
||||||
// System configuration: type=Dedicated mode=Donating smt=8 lcpu=16 mem=4096MB
|
// System configuration: type=Dedicated mode=Donating smt=8 lcpu=16 mem=4096MB
|
||||||
private final Pattern patternAixDedicated = Pattern.compile("^System configuration: type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+)MB");
|
private static final Pattern patternAixDedicated = Pattern.compile("^System configuration: type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+)MB");
|
||||||
|
|
||||||
// type=Shared mode=Uncapped smt=8 lcpu=4 mem=4101120 kB cpus=24 ent=4.00
|
// type=Shared mode=Uncapped smt=8 lcpu=4 mem=4101120 kB cpus=24 ent=4.00
|
||||||
private final Pattern patternLinux = Pattern.compile("^type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+) kB cpus=(\\d+) ent=(\\d+\\.?\\d*)");
|
private static final Pattern patternLinux = Pattern.compile("^type=(\\S+) mode=(\\S+) smt=(\\d+) lcpu=(\\d+) mem=(\\d+) kB cpus=(\\d+) ent=(\\d+\\.?\\d*)");
|
||||||
|
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
@ -144,18 +144,18 @@ public class AixProcessorStat {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public HashMap<String, Object> getFields() {
|
||||||
HashMap<String, Object> fields = new HashMap<>();
|
return new HashMap<String, Object>() {{
|
||||||
fields.put("lcpu", lcpu);
|
put("lcpu", lcpu);
|
||||||
fields.put("ent", ent);
|
put("ent", ent);
|
||||||
fields.put("user", user);
|
put("user", user);
|
||||||
fields.put("sys", sys);
|
put("sys", sys);
|
||||||
fields.put("idle", idle);
|
put("idle", idle);
|
||||||
fields.put("wait", wait);
|
put("wait", wait);
|
||||||
fields.put("physc", physc);
|
put("physc", physc);
|
||||||
fields.put("entc", entc);
|
put("entc", entc);
|
||||||
fields.put("lbusy", lbusy);
|
put("lbusy", lbusy);
|
||||||
fields.put("mode", mode);
|
put("mode", mode);
|
||||||
fields.put("type", type);
|
put("type", type);
|
||||||
return fields;
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
for(HWDiskStore store : diskStores) {
|
for(HWDiskStore store : diskStores) {
|
||||||
|
|
||||||
String name = store.getName();
|
String name = store.getName();
|
||||||
if (name.matches("hdisk[0-9]+") || name.matches("/dev/x?[sv]d[a-z]") || name.matches("/dev/nvme[0-9]n[0-9]")) {
|
if (name.matches("h?disk[0-9]+") || name.matches("/dev/x?[sv]d[a-z]") || name.matches("/dev/nvme[0-9]n[0-9]")) {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
||||||
put("name", name);
|
put("name", name);
|
||||||
|
@ -91,7 +91,6 @@ public class BaseDiskExtension implements MetricExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MetricResult(name, measurementList);
|
return new MetricResult(name, measurementList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,8 +30,10 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
add("influxd");
|
add("influxd");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
private final long minUptimeInSeconds = 300;
|
||||||
private SystemInfo systemInfo;
|
private SystemInfo systemInfo;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
|
@ -82,11 +84,16 @@ public class BaseProcessExtension implements MetricExtension {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip short-lived processes
|
||||||
|
if(p.getUpTime() < (minUptimeInSeconds * 1000)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String name = p.getName();
|
String name = p.getName();
|
||||||
if(!includeList.contains(name)) {
|
if(!includeList.contains(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
log.debug("pid: " + p.getProcessID() + ", name: " + name + ", virt: " + p.getVirtualSize() + " rss: " + p.getResidentSetSize());
|
log.info("pid: " + p.getProcessID() + ", name: " + name + ", virt: " + p.getVirtualSize() + " rss: " + p.getResidentSetSize());
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
HashMap<String, String> tagsMap = new HashMap<String, String>() {{
|
||||||
put("pid", String.valueOf(p.getProcessID()));
|
put("pid", String.valueOf(p.getProcessID()));
|
||||||
|
|
|
@ -74,8 +74,8 @@ public class LinuxNetstatExtension implements MetricExtension {
|
||||||
@Override
|
@Override
|
||||||
public MetricResult getMetrics() throws Exception {
|
public MetricResult getMetrics() throws Exception {
|
||||||
|
|
||||||
HashMap<String, String> tagsMap = null;
|
HashMap<String, String> tagsMap;
|
||||||
HashMap<String, Object> fieldsMap = null;
|
HashMap<String, Object> fieldsMap;
|
||||||
|
|
||||||
try (InputStream inputStream = PluginHelper.executeCommand("netstat -s")) {
|
try (InputStream inputStream = PluginHelper.executeCommand("netstat -s")) {
|
||||||
LinuxNetstatParser parser = processCommandOutput(inputStream);
|
LinuxNetstatParser parser = processCommandOutput(inputStream);
|
||||||
|
@ -83,7 +83,6 @@ public class LinuxNetstatExtension implements MetricExtension {
|
||||||
fieldsMap = parser.getFields();
|
fieldsMap = parser.getFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug(fieldsMap.toString());
|
|
||||||
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,20 +144,17 @@ public class LinuxNetstatParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public HashMap<String, Object> getFields() {
|
||||||
HashMap<String, Object> fields = new HashMap<>();
|
return new HashMap<String, Object>() {{
|
||||||
fields.put("ip_forwarded", ipForwarded);
|
put("ip_forwarded", ipForwarded);
|
||||||
fields.put("ip_received", ipTotalPacketsReceived);
|
put("ip_received", ipTotalPacketsReceived);
|
||||||
fields.put("ip_dropped", ipOutgoingPacketsDropped);
|
put("ip_dropped", ipOutgoingPacketsDropped);
|
||||||
fields.put("ip_discarded", ipIncomingPacketsDiscarded);
|
put("ip_discarded", ipIncomingPacketsDiscarded);
|
||||||
|
put("tcp_connections", tcpConnectionsEstablished);
|
||||||
fields.put("tcp_connections", tcpConnectionsEstablished);
|
put("tcp_pkts_recv", tcpSegmentsReceived);
|
||||||
fields.put("tcp_pkts_recv", tcpSegmentsReceived);
|
put("tcp_pkts_sent", tcpSegmentsSent);
|
||||||
fields.put("tcp_pkts_sent", tcpSegmentsSent);
|
put("udp_pkts_recv", udpPacketsReceived);
|
||||||
|
put("udp_pkts_sent", udpPacketsSent);
|
||||||
fields.put("udp_pkts_recv", udpPacketsReceived);
|
}};
|
||||||
fields.put("udp_pkts_sent", udpPacketsSent);
|
|
||||||
|
|
||||||
return fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long getFirstLong(String line) {
|
private Long getFirstLong(String line) {
|
||||||
|
|
|
@ -81,16 +81,16 @@ public class LinuxNetworkSockStat {
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, Object> getFields() {
|
public HashMap<String, Object> getFields() {
|
||||||
HashMap<String, Object> fields = new HashMap<>();
|
return new HashMap<String, Object>() {{
|
||||||
fields.put("sockets", sockets);
|
put("sockets", sockets);
|
||||||
fields.put("tcp_inuse", tcp_inuse);
|
put("tcp_inuse", tcp_inuse);
|
||||||
fields.put("tcp_alloc", tcp_alloc);
|
put("tcp_alloc", tcp_alloc);
|
||||||
fields.put("tcp_orphan", tcp_orphan);
|
put("tcp_orphan", tcp_orphan);
|
||||||
fields.put("tcp_mem", tcp_mem);
|
put("tcp_mem", tcp_mem);
|
||||||
fields.put("tcp_tw", tcp_tw);
|
put("tcp_tw", tcp_tw);
|
||||||
fields.put("udp_inuse", udp_inuse);
|
put("udp_inuse", udp_inuse);
|
||||||
fields.put("udp_mem", udp_mem);
|
put("udp_mem", udp_mem);
|
||||||
return fields;
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,7 @@ public class LinuxSockstatExtension implements MetricExtension {
|
||||||
HashMap<String, String> tagsMap = sockStat.getTags();
|
HashMap<String, String> tagsMap = sockStat.getTags();
|
||||||
HashMap<String, Object> fieldsMap = sockStat.getFields();
|
HashMap<String, Object> fieldsMap = sockStat.getFields();
|
||||||
|
|
||||||
log.debug(fieldsMap.toString());
|
|
||||||
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
return new MetricResult(name, new Measurement(tagsMap, fieldsMap));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LinuxNetworkSockStat processSockOutput(List<String> inputLines) {
|
protected LinuxNetworkSockStat processSockOutput(List<String> inputLines) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class ServerRouteBuilder extends RouteBuilder {
|
||||||
.process(new MetricResultToPointProcessor(dbname))
|
.process(new MetricResultToPointProcessor(dbname))
|
||||||
.toF("influxdb://ref.myInfluxConnection?batch=true") //&retentionPolicy=autogen
|
.toF("influxdb://ref.myInfluxConnection?batch=true") //&retentionPolicy=autogen
|
||||||
.doCatch(Exception.class)
|
.doCatch(Exception.class)
|
||||||
.log("Error storing metric to InfluxDB: ${exception}")
|
.log(LoggingLevel.WARN, "Error: ${exception}")
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue