Update dashboard.

This commit is contained in:
Mark Nellemann 2022-11-30 16:22:47 +01:00
parent d9cc633626
commit 9b35a6f3dc
3 changed files with 63 additions and 50 deletions

View file

@ -35,6 +35,12 @@
"name": "Stat", "name": "Stat",
"version": "" "version": ""
}, },
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
},
{ {
"type": "panel", "type": "panel",
"id": "text", "id": "text",
@ -115,8 +121,10 @@
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "custom": {
"mode": "palette-classic" "align": "center",
"displayMode": "auto",
"inspect": false
}, },
"mappings": [], "mappings": [],
"thresholds": { "thresholds": {
@ -128,30 +136,26 @@
} }
] ]
}, },
"unit": "text" "unit": "string"
}, },
"overrides": [] "overrides": []
}, },
"gridPos": { "gridPos": {
"h": 6, "h": 3,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 3 "y": 3
}, },
"id": 35, "id": 35,
"options": { "options": {
"colorMode": "none", "footer": {
"graphMode": "none", "fields": "",
"justifyMode": "center", "reducer": [
"orientation": "auto", "sum"
"reduceOptions": {
"calcs": [
"lastNotNull"
], ],
"fields": "/.*/", "show": false
"values": false
}, },
"textMode": "value_and_name" "showHeader": true
}, },
"pluginVersion": "9.1.6", "pluginVersion": "9.1.6",
"targets": [ "targets": [
@ -184,7 +188,7 @@
"measurement": "base_info", "measurement": "base_info",
"orderByTime": "DESC", "orderByTime": "DESC",
"policy": "default", "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", "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 \"hostname\" fill(previous) ORDER BY time DESC LIMIT 1",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "table", "resultFormat": "table",
@ -350,7 +354,8 @@
} }
} }
], ],
"type": "stat" "transparent": true,
"type": "table"
}, },
{ {
"datasource": { "datasource": {
@ -415,7 +420,7 @@
"h": 5, "h": 5,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 9 "y": 6
}, },
"id": 2, "id": 2,
"options": { "options": {
@ -647,7 +652,7 @@
"h": 5, "h": 5,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 9 "y": 6
}, },
"id": 16, "id": 16,
"options": { "options": {
@ -876,7 +881,7 @@
"h": 6, "h": 6,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 14 "y": 11
}, },
"id": 29, "id": 29,
"options": { "options": {
@ -984,6 +989,12 @@
], ],
"type": "moving_average" "type": "moving_average"
}, },
{
"params": [
"*-1"
],
"type": "math"
},
{ {
"params": [ "params": [
"steal" "steal"
@ -1137,7 +1148,7 @@
"h": 6, "h": 6,
"w": 4, "w": 4,
"x": 12, "x": 12,
"y": 14 "y": 11
}, },
"id": 19, "id": 19,
"options": { "options": {
@ -1313,7 +1324,7 @@
"h": 6, "h": 6,
"w": 8, "w": 8,
"x": 16, "x": 16,
"y": 14 "y": 11
}, },
"id": 17, "id": 17,
"options": { "options": {
@ -1488,7 +1499,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 20 "y": 17
}, },
"id": 10, "id": 10,
"options": { "options": {
@ -1648,7 +1659,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 20 "y": 17
}, },
"id": 30, "id": 30,
"options": { "options": {
@ -1809,7 +1820,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 29 "y": 26
}, },
"id": 18, "id": 18,
"options": { "options": {
@ -1964,7 +1975,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 29 "y": 26
}, },
"id": 31, "id": 31,
"options": { "options": {
@ -2074,8 +2085,7 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "green", "color": "green"
"value": null
} }
] ]
}, },
@ -2184,7 +2194,7 @@
"h": 5, "h": 5,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 38 "y": 35
}, },
"id": 22, "id": 22,
"options": { "options": {
@ -2479,8 +2489,7 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "green", "color": "green"
"value": null
}, },
{ {
"color": "red", "color": "red",
@ -2496,7 +2505,7 @@
"h": 10, "h": 10,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 43 "y": 40
}, },
"id": 24, "id": 24,
"options": { "options": {
@ -2638,8 +2647,7 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "green", "color": "green"
"value": null
} }
] ]
}, },
@ -2651,7 +2659,7 @@
"h": 10, "h": 10,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 43 "y": 40
}, },
"id": 25, "id": 25,
"options": { "options": {
@ -2779,8 +2787,7 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "green", "color": "green"
"value": null
}, },
{ {
"color": "red", "color": "red",
@ -2796,7 +2803,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 0, "x": 0,
"y": 53 "y": 50
}, },
"id": 8, "id": 8,
"options": { "options": {
@ -2973,8 +2980,7 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "transparent", "color": "transparent"
"value": null
}, },
{ {
"color": "orange", "color": "orange",
@ -2994,7 +3000,7 @@
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 12,
"y": 53 "y": 50
}, },
"id": 26, "id": 26,
"options": { "options": {
@ -3151,6 +3157,6 @@
"timezone": "", "timezone": "",
"title": "Sysmon - Host Overview", "title": "Sysmon - Host Overview",
"uid": "QkVPjseMt", "uid": "QkVPjseMt",
"version": 18, "version": 21,
"weekStart": "" "weekStart": ""
} }

View file

@ -8,6 +8,7 @@ import oshi.hardware.HardwareAbstractionLayer;
import sysmon.shared.Measurement; import sysmon.shared.Measurement;
import sysmon.shared.MetricExtension; import sysmon.shared.MetricExtension;
import sysmon.shared.MetricResult; import sysmon.shared.MetricResult;
import sysmon.shared.PluginHelper;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -105,15 +106,15 @@ public class BaseProcessorExtension implements MetricExtension {
long nonBusy = idle + iowait; long nonBusy = idle + iowait;
long total = busy + nonBusy; long total = busy + nonBusy;
fieldsMap.put("system", ((float) system / (float) total) * 100); fieldsMap.put("system", PluginHelper.round(((double) system / (double) total) * 100, 2));
fieldsMap.put("user", ((float) user / (float) total) * 100); fieldsMap.put("user", PluginHelper.round(((double) user / (double) total) * 100, 2));
fieldsMap.put("nice", ((float) nice / (float) total) * 100); fieldsMap.put("nice", PluginHelper.round(((double) nice / (double) total) * 100, 2));
fieldsMap.put("iowait", ((float) iowait / (float) total) * 100); fieldsMap.put("iowait", PluginHelper.round(((double) iowait / (double) total) * 100, 2));
fieldsMap.put("steal", ((float) steal / (float) total) * 100); fieldsMap.put("steal", PluginHelper.round(((double) steal / (double) total) * 100, 2));
fieldsMap.put("irq", ((float) irq / (float) total) * 100); fieldsMap.put("irq", PluginHelper.round(((double) irq / (double) total) * 100, 2));
fieldsMap.put("softirq", ((float) softirq / (float) total) * 100); fieldsMap.put("softirq", PluginHelper.round(((double) softirq / (double) total) * 100, 2));
fieldsMap.put("idle", ((float) idle / (float) total) * 100); fieldsMap.put("idle", PluginHelper.round(((double) idle / (double) total) * 100, 2));
fieldsMap.put("busy", ((float) busy / (float) total) * 100); fieldsMap.put("busy", PluginHelper.round(((double) busy / (double) total) * 100, 2));
oldTicks = ticks; oldTicks = ticks;
log.debug(fieldsMap.toString()); log.debug(fieldsMap.toString());

View file

@ -69,4 +69,10 @@ public class PluginHelper {
return allLines; return allLines;
} }
public static double round(double average, int scale) {
double pow = Math.pow(10, scale);
return Math.round(average * pow) / pow;
}
} }