Merged in development (pull request #7)

Example dashboards.
This commit is contained in:
Mark Nellemann 2021-09-07 09:16:38 +00:00
commit 5aae01a792
7 changed files with 1509 additions and 236 deletions

View file

@ -2,8 +2,8 @@
Java based system monitoring solution with support for plugins.
- Example Grafana [dashboard](https://bitbucket.org/mnellemann/sysmon/downloads/sysmon-example-dashboard.png) showing metrics from a host running *sysmon*.
- 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.
## Known problems
@ -32,12 +32,16 @@ DELETE WHERE hostname = 'unknown';
Runs on your hosts and collects metrics, which are sent to the central *server*.
[More information](client/README.md).
### Server
Receives aggregated metrics from clients and saves these into InfluxDB.
[More information](server/README.md).
### Plugins
Loaded by the client and provides extensions for doing the actual collecting of metrics.
[More information](plugins/README.md).

View file

@ -37,7 +37,7 @@ def projectName = "sysmon-client"
application {
// Define the main class for the application.
mainClass.set('sysmon.client.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms32m", "-Xmx32m" ]
applicationDefaultJvmArgs = [ "-server", "-XX:+UseG1GC", "-Xmx32m" ]
}
run {

View file

@ -0,0 +1,980 @@
{
"__inputs": [
{
"name": "DS_INFLUXDB-SYSMON",
"label": "InfluxDB-sysmon",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__requires": [
{
"type": "panel",
"id": "gauge",
"name": "Gauge",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "8.0.6"
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Metrics from within host / guest / partition.",
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1631005248811,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": null,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 4,
"panels": [],
"repeat": "hostname",
"title": "${hostname}",
"type": "row"
},
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "base_process.user"
},
"properties": [
{
"id": "displayName",
"value": "User"
}
]
},
{
"matcher": {
"id": "byName",
"options": "base_process.group"
},
"properties": [
{
"id": "displayName",
"value": "Group"
}
]
},
{
"matcher": {
"id": "byName",
"options": "base_process.path"
},
"properties": [
{
"id": "displayName",
"value": "Path"
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 1
},
"id": 16,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "center",
"orientation": "vertical",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "value_and_name"
},
"pluginVersion": "8.0.6",
"targets": [
{
"groupBy": [],
"measurement": "base_process",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"user"
],
"type": "field"
},
{
"params": [
"user"
],
"type": "alias"
}
],
[
{
"params": [
"group"
],
"type": "field"
},
{
"params": [
"group"
],
"type": "alias"
}
],
[
{
"params": [
"path"
],
"type": "field"
},
{
"params": [
"path"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/^$process$/"
},
{
"condition": "AND",
"key": "pid",
"operator": "=~",
"value": "/^$pid$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Details",
"type": "stat"
},
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "base_process.rss"
},
"properties": [
{
"id": "displayName",
"value": "Resident"
}
]
},
{
"matcher": {
"id": "byName",
"options": "base_process.virt"
},
"properties": [
{
"id": "displayName",
"value": "Virtual"
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 7,
"x": 12,
"y": 1
},
"id": 19,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.6",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"linear"
],
"type": "fill"
}
],
"measurement": "base_process",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"mem_rss"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"rss"
],
"type": "alias"
}
],
[
{
"params": [
"mem_virt"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"virt"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/^$process$/"
},
{
"condition": "AND",
"key": "pid",
"operator": "=~",
"value": "/^$pid$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Memory Metrics",
"type": "stat"
},
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "base_process.read"
},
"properties": [
{
"id": "displayName",
"value": "Read Bytes"
}
]
},
{
"matcher": {
"id": "byName",
"options": "base_process.write"
},
"properties": [
{
"id": "displayName",
"value": "Write Bytes"
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 5,
"x": 19,
"y": 1
},
"id": 26,
"options": {
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true,
"text": {}
},
"pluginVersion": "8.0.6",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "base_process",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"read_bytes"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [],
"type": "non_negative_difference"
},
{
"params": [
"read"
],
"type": "alias"
}
],
[
{
"params": [
"write_bytes"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [],
"type": "non_negative_difference"
},
{
"params": [
"write"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/^$process$/"
},
{
"condition": "AND",
"key": "pid",
"operator": "=~",
"value": "/^$pid$/"
}
]
}
],
"timeFrom": null,
"timeShift": null,
"title": "Disk Metrics",
"type": "gauge"
},
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "dtdurationms"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 12,
"x": 0,
"y": 7
},
"id": 24,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.6",
"targets": [
{
"alias": "$col",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "base_process",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT non_negative_difference(sum(last(\"user_time\"),last(\"kernel_time\"))) FROM \"base_process\" WHERE (\"hostname\" =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval), \"pid\", \"name\" fill(null)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"user_time"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [],
"type": "non_negative_difference"
},
{
"params": [
"user"
],
"type": "alias"
}
],
[
{
"params": [
"kernel_time"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [],
"type": "non_negative_difference"
},
{
"params": [
"kernel"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/^$process$/"
},
{
"condition": "AND",
"key": "pid",
"operator": "=~",
"value": "/^$pid$/"
}
]
}
],
"title": "Processor Time",
"type": "timeseries"
},
{
"datasource": "${DS_INFLUXDB-SYSMON}",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 12,
"x": 12,
"y": 7
},
"id": 25,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.6",
"targets": [
{
"alias": "$col",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"name"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "base_process",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT sum(non_negative_derivative(mean(\"user_time\"), 30s), non_negative_derivative(mean(\"user_time\"), 30s)) FROM \"base_process\" WHERE (\"hostname\" =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval), \"pid\", \"name\" fill(null)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"files"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"files"
],
"type": "alias"
}
],
[
{
"params": [
"threads"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"threads"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "name",
"operator": "=~",
"value": "/^$process$/"
},
{
"condition": "AND",
"key": "pid",
"operator": "=~",
"value": "/^$pid$/"
}
]
}
],
"title": "Threads & Open Files",
"type": "timeseries"
}
],
"refresh": "1m",
"schemaVersion": 30,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {},
"datasource": "${DS_INFLUXDB-SYSMON}",
"definition": "SHOW TAG VALUES FROM \"base_memory\" WITH KEY = \"hostname\" WHERE time > now() - 60m",
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": "Host",
"multi": false,
"name": "hostname",
"options": [],
"query": "SHOW TAG VALUES FROM \"base_memory\" WITH KEY = \"hostname\" WHERE time > now() - 60m",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "${DS_INFLUXDB-SYSMON}",
"definition": "SHOW TAG VALUES FROM \"base_process\" WITH KEY = \"name\" WHERE hostname =~ /$hostname/AND time > now() - 60m",
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": "Process",
"multi": false,
"name": "process",
"options": [],
"query": "SHOW TAG VALUES FROM \"base_process\" WITH KEY = \"name\" WHERE hostname =~ /$hostname/AND time > now() - 60m",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": null,
"current": {},
"datasource": "${DS_INFLUXDB-SYSMON}",
"definition": "SHOW TAG VALUES FROM \"base_process\" WITH KEY = \"pid\" WHERE hostname =~ /$hostname/AND \"name\" =~ /$process/ AND time > now() - 60m",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": "PID",
"multi": false,
"name": "pid",
"options": [],
"query": "SHOW TAG VALUES FROM \"base_process\" WITH KEY = \"pid\" WHERE hostname =~ /$hostname/AND \"name\" =~ /$process/ AND time > now() - 60m",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-3h",
"to": "now-30s"
},
"timepicker": {
"nowDelay": "30s",
"refresh_intervals": [
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Sysmon - Process Explorer",
"uid": "Vjut5mS7k",
"version": 6
}

View file

@ -3,4 +3,4 @@ pf4jVersion=3.6.0
slf4jVersion=1.7.32
camelVersion=3.11.1
picocliVersion=4.6.1
oshiVersion=5.8.1
oshiVersion=5.8.2

View file

@ -78,8 +78,8 @@ public class BaseProcessExtension implements MetricExtension {
tagsMap.put("pid", String.valueOf(p.getProcessID()));
tagsMap.put("name", name);
//tagsMap.put("path", p.getPath());
fieldsMap.put("path", p.getPath());
fieldsMap.put("mem_rss", p.getResidentSetSize());
fieldsMap.put("mem_virt", p.getVirtualSize());
fieldsMap.put("kernel_time", p.getKernelTime());

View file

@ -28,7 +28,7 @@ def projectName = "sysmon-server"
application {
// Define the main class for the application.
mainClass.set('sysmon.server.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms128m", "-Xmx128m" ]
applicationDefaultJvmArgs = [ "-server", "-XX:+UseG1GC", "-Xmx128m" ]
}
tasks.named('test') {