Fix 500 status code when POST'ing to server.
Various improvements to plugins.
This commit is contained in:
parent
66cd7c735b
commit
cca1c099df
|
@ -17,6 +17,7 @@ dependencies {
|
|||
|
||||
annotationProcessor "info.picocli:picocli-codegen:${picocliVersion}"
|
||||
implementation "info.picocli:picocli:${picocliVersion}"
|
||||
implementation 'org.tomlj:tomlj:1.0.0'
|
||||
|
||||
implementation group: 'org.apache.camel', name: 'camel-core', version: camelVersion
|
||||
implementation group: 'org.apache.camel', name: 'camel-main', version: camelVersion
|
||||
|
|
|
@ -47,7 +47,7 @@ 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:"+provides+"?fixedRate=true&period=10s")
|
||||
from("timer:"+provides+"?fixedRate=true&period=30s")
|
||||
.bean(ext, "getMetrics")
|
||||
//.doTry()
|
||||
.process(new MetricEnrichProcessor(registry))
|
||||
|
|
44
plugins/sysmon-aix/README.md
Normal file
44
plugins/sysmon-aix/README.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
# AIX Plugin
|
||||
|
||||
## Processor Extension
|
||||
|
||||
The processor extension works for both AIX and Linux on the Power ppc64/ppc64le architecture.
|
||||
|
||||
Metrics reported are:
|
||||
|
||||
- **mode** - Processor mode, Capped or Uncapped
|
||||
- **type** - Processor type, Shared or Dedicated
|
||||
- **lcpu** - Number of logical CPU's available for this partition
|
||||
- **ent** - Processor entitlements available for this partition
|
||||
- **user** - Indicates the percentage of the entitled processing capacity used while executing at the user level (application).
|
||||
- **sys** - Indicates the percentage of the entitled processing capacity used while executing at the system level (kernel).
|
||||
- **idle** - Indicates the percentage of the entitled processing capacity unused while the partition was idle and did not have any outstanding disk I/O request.
|
||||
- **wait** - Indicates the percentage of the entitled processing capacity unused while the partition was idle and had outstanding disk I/O request(s).
|
||||
- **physc** - Indicates the number of physical processors consumed.
|
||||
- **entc** - Indicates the percentage of the entitled capacity consumed.
|
||||
- **lbusy** - Indicates the percentage of logical processor(s) utilization that occurred while executing at the user and system level.
|
||||
|
||||
|
||||
## Memory Extension
|
||||
|
||||
Metrics reported are:
|
||||
|
||||
- **total** - Total amount of memory (in KB).
|
||||
- **used** - real memory consumption (in KB).
|
||||
- **free** - free memory for use (in KB).
|
||||
- **pin** - pinned memory consumption (in KB).
|
||||
- **virtual** - virtual memory consumption (in KB).
|
||||
- **available** - available memory (if freeing up virtual) (in KB).
|
||||
- **paged** - paging space consumption (in KB).
|
||||
|
||||
*Pinning a memory region prohibits the pager from stealing pages from the pages backing the pinned memory region.*
|
||||
|
||||
## Disk Extension
|
||||
|
||||
Only reports first device found. Improvements on the TODO.
|
||||
|
||||
Metrics reported are:
|
||||
|
||||
- **device** - Name of device.
|
||||
- **reads** - The total number of KB read.
|
||||
- **writes** - The total number of KB written.
|
|
@ -50,7 +50,7 @@ public class AixDiskExtension implements MetricExtension {
|
|||
@Override
|
||||
public MetricResult getMetrics() {
|
||||
|
||||
List<String> iostat = PluginHelper.executeCommand("iostat -d");
|
||||
List<String> iostat = PluginHelper.executeCommand("iostat -d 1 1");
|
||||
AixDiskStat diskStat = processCommandOutput(iostat);
|
||||
|
||||
Map<String, String> tagsMap = diskStat.getTags();
|
||||
|
|
|
@ -50,7 +50,8 @@ public class AixMemoryExtension implements MetricExtension {
|
|||
@Override
|
||||
public MetricResult getMetrics() {
|
||||
|
||||
List<String> svmon = PluginHelper.executeCommand("svmon -G -O unit=KB");
|
||||
//List<String> svmon = PluginHelper.executeCommand("svmon -G -O unit=KB");
|
||||
List<String> svmon = PluginHelper.executeCommand("svmon -G -O summary=longreal,unit=KB");
|
||||
AixMemoryStat memoryStat = processCommandOutput(svmon);
|
||||
|
||||
Map<String, String> tagsMap = memoryStat.getTags();
|
||||
|
|
|
@ -15,28 +15,27 @@ public class AixMemoryStat {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(AixMemoryStat.class);
|
||||
|
||||
// size inuse free pin virtual available mmode
|
||||
// memory 4194304 4036532 157772 1854772 2335076 1652640 Ded
|
||||
private final Pattern patternAix = Pattern.compile("^memory\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+)");
|
||||
private final Pattern pattern = Pattern.compile("^\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)");
|
||||
|
||||
private Long total;
|
||||
private Long used;
|
||||
private Long free;
|
||||
private Long pin;
|
||||
private Long virtual;
|
||||
private Long available;
|
||||
private String mode;
|
||||
private Long paged;
|
||||
|
||||
AixMemoryStat(List<String> lines) {
|
||||
for (String line : lines) {
|
||||
Matcher matcher = patternAix.matcher(line);
|
||||
Matcher matcher = pattern.matcher(line);
|
||||
if (matcher.find() && matcher.groupCount() == 7) {
|
||||
total = Long.parseLong(matcher.group(1));
|
||||
used = Long.parseLong(matcher.group(2));
|
||||
free = Long.parseLong(matcher.group(3));
|
||||
//pin = Long.parseLong(matcher.group(4));
|
||||
pin = Long.parseLong(matcher.group(4));
|
||||
virtual = Long.parseLong(matcher.group(5));
|
||||
available = Long.parseLong(matcher.group(6));
|
||||
mode = matcher.group(7);
|
||||
paged = Long.parseLong(matcher.group(7));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +44,6 @@ public class AixMemoryStat {
|
|||
|
||||
public Map<String, String> getTags() {
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("mode", mode);
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
@ -59,8 +57,10 @@ public class AixMemoryStat {
|
|||
fields.put("total", total);
|
||||
fields.put("used", used);
|
||||
fields.put("free", free);
|
||||
fields.put("pin", pin);
|
||||
fields.put("virtual", virtual);
|
||||
fields.put("available", available);
|
||||
fields.put("paged", paged);
|
||||
fields.put("usage", usage.doubleValue());
|
||||
return fields;
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ class AixMemoryTest extends Specification {
|
|||
AixMemoryStat stats = extension.processCommandOutput(lines)
|
||||
|
||||
then:
|
||||
|
||||
stats.getFields().get("total") == 4194304l
|
||||
stats.getFields().get("used") == 4036532l
|
||||
stats.getFields().get("free") == 157772l
|
||||
stats.getFields().get("virtual") == 2335076l
|
||||
stats.getFields().get("available") == 1652640l
|
||||
stats.getFields().get("usage") == 60.6d
|
||||
stats.getTags().get("mode") == "Ded"
|
||||
stats.getFields().get("used") == 4065060l
|
||||
stats.getFields().get("free") == 129244l
|
||||
stats.getFields().get("pin") == 1878240l
|
||||
stats.getFields().get("virtual") == 2784988l
|
||||
stats.getFields().get("available") == 1058012l
|
||||
stats.getFields().get("paged") == 524288l
|
||||
stats.getFields().get("usage") == 74.78d
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
Unit: KB
|
||||
--------------------------------------------------------------------------------------
|
||||
size inuse free pin virtual available mmode
|
||||
memory 4194304 4036532 157772 1854772 2335076 1652640 Ded
|
||||
pg space 524288 12400
|
||||
|
||||
work pers clnt other
|
||||
pin 1407060 0 16736 430976
|
||||
in use 2335076 0 1701456
|
||||
------------------------------------------------------------------------
|
||||
Memory
|
||||
------------------------------------------------------------------------
|
||||
Size Inuse Free Pin Virtual Available Pgsp
|
||||
4194304 4065060 129244 1878240 2784988 1058012 524288
|
||||
|
|
36
plugins/sysmon-linux/README.md
Normal file
36
plugins/sysmon-linux/README.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Linux Plugin
|
||||
|
||||
## Processor Extension
|
||||
|
||||
Reports the following metrics seen:
|
||||
|
||||
- **user** - Percentage of CPU time spend on user processes.
|
||||
- **sys** - Percentage of CPU time spend on system processes.
|
||||
- **wait** - Percentage of CPU time spend on waiting (for i/o).
|
||||
- **idle** - Percentage of CPU time spend on idle (doing nothing).
|
||||
- **busy** - Percentage of CPU time not spend on idle (working).
|
||||
|
||||
|
||||
## Memory Extension
|
||||
|
||||
Reports the following metrics, from the *free* command:
|
||||
|
||||
- **total** - The total amount of (installed) memory (in KB).
|
||||
- **used** - Used memory (calculated as total - free - buffers - cache) (in KB).
|
||||
- **free** - Unused memory (MemFree and SwapFree in /proc/meminfo) (in KB).
|
||||
- **shared** - Memory used (mostly) by tmpfs (Shmem in /proc/meminfo) (in KB).
|
||||
- **buffers** - Sum of buffers and cache (in KB).
|
||||
- **available** - Estimation of how much memory is available for starting new applications, without swapping (in KB).
|
||||
- **usage** - Percentage of memory used out of the total amount of memory.
|
||||
|
||||
|
||||
## Disk Extension
|
||||
|
||||
|
||||
Only reports first device found. Improvements on the TODO.
|
||||
|
||||
Metrics reported are:
|
||||
|
||||
- **device** - Name of device.
|
||||
- **reads** - The total number of KB read.
|
||||
- **writes** - The total number of KB written.
|
|
@ -54,7 +54,6 @@ public class LinuxDiskExtension implements MetricExtension {
|
|||
LinuxDiskProcLine proc2 = processFileOutput(readProcFile());
|
||||
|
||||
LinuxDiskStat stat = new LinuxDiskStat(proc1, proc2);
|
||||
System.err.println("FOOBAR");
|
||||
return new MetricResult("disk", new Measurement(stat.getTags(), stat.getFields()));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ public class MetricResultToPointProcessor implements Processor {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
exchange.getIn().setBody(builder.build());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.sysmon.server;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.model.rest.RestBindingMode;
|
||||
import org.apache.camel.spi.Registry;
|
||||
|
@ -32,6 +33,8 @@ public class ServerRouteBuilder extends RouteBuilder {
|
|||
.produces("text/html")
|
||||
.type(MetricResult.class)
|
||||
.route()
|
||||
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(202))
|
||||
.setHeader("Content-Type", constant("application/x-www-form-urlencoded"))
|
||||
.to("seda:inbound")
|
||||
.endRest();
|
||||
|
||||
|
|
Loading…
Reference in a new issue