Update dashboard to include system information and only submit this once an hour per. default.

Bump version to 1.0.x
This commit is contained in:
Mark Nellemann 2022-09-06 15:08:52 +02:00
parent abef741218
commit dd475c6d23
22 changed files with 415 additions and 51 deletions

View File

@ -1,3 +0,0 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

View File

@ -4,6 +4,10 @@
### Example configuration with default values. ### Example configuration with default values.
### ###
[extension.base_info]
enabled = true
interval = '60m'
[extension.base_disk] [extension.base_disk]
enabled = true enabled = true

View File

@ -61,7 +61,8 @@ public class ClientRouteBuilder extends RouteBuilder {
// Setup Camel route for this extension // 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. // a unique timer name gives the timer it's own thread, otherwise it's a shared thread for other timers with same name.
String timerName = ext.isThreaded() ? ext.getProvides() : "default"; String timerName = ext.isThreaded() ? ext.getProvides() : "default";
from("timer:"+timerName+"?fixedRate=true&period=30s") String timerInterval = (ext.getInterval() != null) ? ext.getInterval() : "30s";
from("timer:"+timerName+"?fixedRate=true&period="+timerInterval)
.bean(ext, "getMetrics") .bean(ext, "getMetrics")
.outputType(MetricResult.class) .outputType(MetricResult.class)
.process(new MetricEnrichProcessor(registry)) .process(new MetricEnrichProcessor(registry))

View File

@ -56,6 +56,8 @@ public final class Configuration {
map.put(k, table.getDouble(k)); map.put(k, table.getDouble(k));
} else if(table.isArray(k)) { } else if(table.isArray(k)) {
map.put(k, Objects.requireNonNull(table.getArray(k)).toList()); map.put(k, Objects.requireNonNull(table.getArray(k)).toList());
} else if(table.isTable(k)) {
map.put(k, table.getTable(k));
} }
}); });
@ -63,4 +65,4 @@ public final class Configuration {
return map; return map;
} }
} }

View File

@ -10,4 +10,5 @@ public class ListOfResultsStrategy extends AbstractListAggregationStrategy<Metri
public MetricResult getValue(Exchange exchange) { public MetricResult getValue(Exchange exchange) {
return exchange.getIn().getBody(MetricResult.class); return exchange.getIn().getBody(MetricResult.class);
} }
}
}

View File

@ -1,5 +1,13 @@
{ {
"__inputs": [ "__inputs": [
{
"name": "DS_INFLUXDB-HMCI",
"label": "InfluxDB-hmci",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
},
{ {
"name": "DS_INFLUXDB-SYSMON", "name": "DS_INFLUXDB-SYSMON",
"label": "InfluxDB-sysmon", "label": "InfluxDB-sysmon",
@ -9,7 +17,7 @@
"pluginName": "InfluxDB" "pluginName": "InfluxDB"
} }
], ],
"__elements": [], "__elements": {},
"__requires": [ "__requires": [
{ {
"type": "panel", "type": "panel",
@ -21,7 +29,7 @@
"type": "grafana", "type": "grafana",
"id": "grafana", "id": "grafana",
"name": "Grafana", "name": "Grafana",
"version": "8.4.7" "version": "9.0.7"
}, },
{ {
"type": "panel", "type": "panel",
@ -58,7 +66,10 @@
"list": [ "list": [
{ {
"builtIn": 1, "builtIn": 1,
"datasource": "-- Grafana --", "datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true, "enable": true,
"hide": true, "hide": true,
"iconColor": "rgba(0, 211, 255, 1)", "iconColor": "rgba(0, 211, 255, 1)",
@ -78,11 +89,14 @@
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"graphTooltip": 0, "graphTooltip": 0,
"id": null, "id": null,
"iteration": 1657611401289,
"links": [], "links": [],
"liveNow": false, "liveNow": false,
"panels": [ "panels": [
{ {
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB-HMCI}"
},
"gridPos": { "gridPos": {
"h": 3, "h": 3,
"w": 24, "w": 24,
@ -94,12 +108,25 @@
"content": "## Metrics are collected by an agent running inside of each LPAR / VM / Host.\n \n For more information: [bitbucket.org/mnellemann/sysmon](https://bitbucket.org/mnellemann/sysmon)\n ", "content": "## Metrics are collected by an agent running inside of each LPAR / VM / Host.\n \n For more information: [bitbucket.org/mnellemann/sysmon](https://bitbucket.org/mnellemann/sysmon)\n ",
"mode": "markdown" "mode": "markdown"
}, },
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB-HMCI}"
},
"refId": "A"
}
],
"transparent": true, "transparent": true,
"type": "text" "type": "text"
}, },
{ {
"collapsed": false, "collapsed": false,
"datasource": {
"type": "influxdb",
"uid": "5KYZifB7z"
},
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
@ -109,9 +136,263 @@
"id": 4, "id": 4,
"panels": [], "panels": [],
"repeat": "hostname", "repeat": "hostname",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "5KYZifB7z"
},
"refId": "A"
}
],
"title": "${hostname}", "title": "${hostname}",
"type": "row" "type": "row"
}, },
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB-SYSMON}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "text"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 4
},
"id": 35,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "center",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/.*/",
"values": false
},
"textMode": "value_and_name"
},
"pluginVersion": "9.0.7",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB-SYSMON}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"hostname"
],
"type": "tag"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"limit": "100",
"measurement": "base_info",
"orderByTime": "DESC",
"policy": "default",
"query": "SELECT last(\"os_manufacturer\") AS \"manufacturer\", last(\"os_family\") AS \"family\", last(\"os_version\") AS \"version\", last(\"os_codename\") AS \"codename\", last(\"os_build\") AS \"build\", last(\"boot_time\") * 1000 AS \"boottime\" FROM \"base_info\" WHERE (\"hostname\" =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval), \"hostname\" fill(null) ORDER BY time DESC LIMIT 1000",
"rawQuery": true,
"refId": "A",
"resultFormat": "table",
"select": [
[
{
"params": [
"os_manufacturer"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"manufacturer"
],
"type": "alias"
}
],
[
{
"params": [
"os_family"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"family"
],
"type": "alias"
}
],
[
{
"params": [
"os_codename"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"codename"
],
"type": "alias"
}
],
[
{
"params": [
"os_build"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"build"
],
"type": "alias"
}
],
[
{
"params": [
"os_version"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"version"
],
"type": "alias"
}
],
[
{
"params": [
"boot_time"
],
"type": "field"
},
{
"params": [],
"type": "last"
},
{
"params": [
"boottime"
],
"type": "alias"
}
]
],
"tags": [
{
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
}
]
}
],
"title": "System Information",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"hostname": true
},
"indexByName": {
"Time": 0,
"boottime": 7,
"build": 6,
"codename": 5,
"family": 3,
"hostname": 1,
"manufacturer": 2,
"version": 4
},
"renameByName": {
"boottime": "Boot Time",
"build": "OS Build",
"codename": "OS Codename",
"family": "OS Family",
"hostname": "Hostname",
"manufacturer": "Manufacturer",
"version": "OS Version"
}
}
},
{
"id": "convertFieldType",
"options": {
"conversions": [
{
"destinationType": "time",
"targetField": "Boot Time"
}
],
"fields": {}
}
}
],
"type": "stat"
},
{ {
"aliasColors": {}, "aliasColors": {},
"bars": false, "bars": false,
@ -128,7 +409,7 @@
"h": 5, "h": 5,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 4 "y": 8
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 2, "id": 2,
@ -149,7 +430,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -398,7 +679,7 @@
"h": 5, "h": 5,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 4 "y": 8
}, },
"id": 16, "id": 16,
"options": { "options": {
@ -416,9 +697,13 @@
"text": {}, "text": {},
"textMode": "value_and_name" "textMode": "value_and_name"
}, },
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"targets": [ "targets": [
{ {
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB-SYSMON}"
},
"groupBy": [ "groupBy": [
{ {
"params": [ "params": [
@ -575,7 +860,7 @@
"h": 6, "h": 6,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 9 "y": 13
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 29, "id": 29,
@ -595,7 +880,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -877,7 +1162,7 @@
"h": 6, "h": 6,
"w": 4, "w": 4,
"x": 12, "x": 12,
"y": 9 "y": 13
}, },
"id": 19, "id": 19,
"options": { "options": {
@ -893,7 +1178,7 @@
"showThresholdMarkers": true, "showThresholdMarkers": true,
"text": {} "text": {}
}, },
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
@ -1051,7 +1336,7 @@
"h": 6, "h": 6,
"w": 8, "w": 8,
"x": 16, "x": 16,
"y": 9 "y": 13
}, },
"id": 17, "id": 17,
"options": { "options": {
@ -1069,7 +1354,7 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
@ -1224,7 +1509,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 15 "y": 19
}, },
"id": 10, "id": 10,
"options": { "options": {
@ -1381,7 +1666,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 15 "y": 19
}, },
"id": 30, "id": 30,
"options": { "options": {
@ -1539,7 +1824,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 24 "y": 28
}, },
"id": 31, "id": 31,
"options": { "options": {
@ -1685,7 +1970,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 24 "y": 28
}, },
"id": 18, "id": 18,
"options": { "options": {
@ -1797,7 +2082,7 @@
"h": 10, "h": 10,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 33 "y": 37
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 24, "id": 24,
@ -1819,7 +2104,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@ -1989,7 +2274,7 @@
"h": 10, "h": 10,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 33 "y": 37
}, },
"id": 25, "id": 25,
"options": { "options": {
@ -2131,7 +2416,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 43 "y": 47
}, },
"id": 8, "id": 8,
"options": { "options": {
@ -2325,7 +2610,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 43 "y": 47
}, },
"id": 26, "id": 26,
"options": { "options": {
@ -2553,7 +2838,7 @@
"h": 6, "h": 6,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 52 "y": 56
}, },
"id": 22, "id": 22,
"options": { "options": {
@ -2571,7 +2856,7 @@
"text": {}, "text": {},
"textMode": "auto" "textMode": "auto"
}, },
"pluginVersion": "8.4.7", "pluginVersion": "9.0.7",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
@ -2757,7 +3042,7 @@
} }
], ],
"refresh": "30s", "refresh": "30s",
"schemaVersion": 35, "schemaVersion": 36,
"style": "dark", "style": "dark",
"tags": [ "tags": [
"sysmon" "sysmon"
@ -2790,7 +3075,7 @@
] ]
}, },
"time": { "time": {
"from": "now-1h", "from": "now-6h",
"to": "now-30s" "to": "now-30s"
}, },
"timepicker": { "timepicker": {
@ -2809,6 +3094,6 @@
"timezone": "", "timezone": "",
"title": "Sysmon Agent - Host Overview", "title": "Sysmon Agent - Host Overview",
"uid": "QkVPjseMk", "uid": "QkVPjseMk",
"version": 24, "version": 29,
"weekStart": "" "weekStart": ""
} }

View File

@ -1,7 +1,7 @@
version = 0.1.15 version = 1.0.16
pf4jVersion = 3.7.0 pf4jVersion = 3.7.0
slf4jVersion = 1.7.36 slf4jVersion = 1.7.36
camelVersion = 3.14.4 camelVersion = 3.14.5
groovyVersion = 3.0.12 groovyVersion = 3.0.12
picocliVersion = 4.6.3 picocliVersion = 4.6.3
oshiVersion = 6.2.2 oshiVersion = 6.2.2

View File

@ -59,6 +59,11 @@ public class AixNetstatExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -60,6 +60,11 @@ public class AixProcessorExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -52,6 +52,11 @@ public class BaseDiskExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;
@ -105,4 +110,4 @@ public class BaseDiskExtension implements MetricExtension {
return new MetricResult(name, measurementList); return new MetricResult(name, measurementList);
} }
} }

View File

@ -62,6 +62,11 @@ public class BaseFilesystemExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;
@ -139,4 +144,4 @@ public class BaseFilesystemExtension implements MetricExtension {
return new MetricResult(name, measurementList); return new MetricResult(name, measurementList);
} }
} }

View File

@ -12,18 +12,20 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Extension @Extension
public class BaseDetailsExtension implements MetricExtension { public class BaseInfoExtension implements MetricExtension {
private static final Logger log = LoggerFactory.getLogger(BaseDetailsExtension.class); private static final Logger log = LoggerFactory.getLogger(BaseInfoExtension.class);
// Extension details // Extension details
private final String name = "base_details"; private final String name = "base_info";
private final String provides = "details"; private final String provides = "info";
private final String description = "Base Details Metrics"; private final String description = "Base System Information";
// Configuration / Options // Configuration / Options
private boolean enabled = true; private boolean enabled = true;
private boolean threaded = false; private boolean threaded = false;
private String interval = "60m";
private HashMap<String, String> tags = new HashMap<>();
private SystemInfo systemInfo; private SystemInfo systemInfo;
@ -54,6 +56,9 @@ public class BaseDetailsExtension implements MetricExtension {
return provides; return provides;
} }
@Override
public String getInterval() { return interval; }
@Override @Override
public String getDescription() { public String getDescription() {
return description; return description;
@ -67,22 +72,25 @@ public class BaseDetailsExtension implements MetricExtension {
if (map.containsKey("threaded")) { if (map.containsKey("threaded")) {
threaded = (boolean) map.get("threaded"); threaded = (boolean) map.get("threaded");
} }
if (map.containsKey("interval")) {
interval = (String) map.get("interval");
}
} }
@Override @Override
public MetricResult getMetrics() { public MetricResult getMetrics() {
HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{ HashMap<String, Object> fieldsMap = new HashMap<String, Object>() {{
put("family", systemInfo.getOperatingSystem().getFamily()); // Freedesktop.org / AIX put("os_manufacturer", systemInfo.getOperatingSystem().getManufacturer()); // GNU/Linux / IBM
put("manufacturer", systemInfo.getOperatingSystem().getManufacturer()); // GNU/Linux / IBM put("os_family", systemInfo.getOperatingSystem().getFamily()); // Freedesktop.org / AIX
put("os_codename", systemInfo.getOperatingSystem().getVersionInfo().getCodeName()); // Flatpak runtime / ppc64 put("os_codename", systemInfo.getOperatingSystem().getVersionInfo().getCodeName()); // Flatpak runtime / ppc64
put("os_version", systemInfo.getOperatingSystem().getVersionInfo().getVersion()); // 21.08.4 / 7.2 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("os_build", systemInfo.getOperatingSystem().getVersionInfo().getBuildNumber()); // 5.13.0-7620-generic / 2045B_72V
put("uptime", systemInfo.getOperatingSystem().getSystemUptime()); put("boot_time", systemInfo.getOperatingSystem().getSystemBootTime());
put("threads", systemInfo.getOperatingSystem().getThreadCount());
}}; }};
return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap)); log.info(fieldsMap.toString());
return new MetricResult(name, new Measurement(tags, fieldsMap));
} }
} }

View File

@ -48,6 +48,11 @@ public class BaseLoadExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -49,6 +49,11 @@ public class BaseMemoryExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -49,6 +49,11 @@ public class BaseNetstatExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;
@ -99,4 +104,4 @@ public class BaseNetstatExtension implements MetricExtension {
return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap)); return new MetricResult(name, new Measurement(new HashMap<>(), fieldsMap));
} }
} }

View File

@ -52,6 +52,11 @@ public class BaseNetworkExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -65,6 +65,11 @@ public class BaseProcessExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -50,6 +50,11 @@ public class BaseProcessorExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -50,6 +50,11 @@ public class TestExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -59,6 +59,11 @@ public class LinuxNetstatExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -53,6 +53,11 @@ public class LinuxSocketExtension implements MetricExtension {
return name; return name;
} }
@Override
public String getInterval() {
return null;
}
@Override @Override
public String getProvides() { public String getProvides() {
return provides; return provides;

View File

@ -11,6 +11,7 @@ public interface MetricExtension extends ExtensionPoint {
boolean isSupported(); boolean isSupported();
String getName(); String getName();
String getInterval();
String getProvides(); String getProvides();
String getDescription(); String getDescription();