feat: add cluster row with CPU and memory to sportmetrics dashboard

This commit is contained in:
2026-03-24 23:52:45 +01:00
parent b4394dbade
commit e802ca044a
@@ -26,22 +26,66 @@ data:
}, },
"editable": true, "editable": true,
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"graphTooltip": 0, "graphTooltip": 1,
"links": [], "links": [],
"templating": {
"list": [
{
"current": {
"text": "Prometheus",
"value": "prometheus"
},
"name": "datasource",
"options": [],
"query": "prometheus",
"refresh": 1,
"type": "datasource"
},
{
"allValue": ".*",
"current": {
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"hide": 2,
"includeAll": true,
"label": "Cluster",
"name": "cluster",
"options": [],
"query": "label_values(node_uname_info{job=\"node-exporter\", sysname!=\"Darwin\"}, cluster)",
"refresh": 2,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"label": "Instance",
"name": "instance",
"options": [],
"query": "label_values(node_uname_info{job=\"node-exporter\", cluster=~\"$cluster\", sysname!=\"Darwin\"}, instance)",
"refresh": 2,
"type": "query"
}
]
},
"panels": [ "panels": [
{ {
"collapsed": false, "collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
"id": 5, "id": 10,
"panels": [], "panels": [],
"title": "Fitness", "title": "Cluster",
"type": "row" "type": "row"
}, },
{ {
"datasource": { "datasource": { "type": "prometheus", "uid": "${datasource}" },
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": { "mode": "palette-classic" },
@@ -54,7 +98,7 @@ data:
"barAlignment": 0, "barAlignment": 0,
"barWidthFactor": 0.6, "barWidthFactor": 0.6,
"drawStyle": "line", "drawStyle": "line",
"fillOpacity": 25, "fillOpacity": 10,
"gradientMode": "none", "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false, "insertNulls": false,
@@ -62,24 +106,165 @@ data:
"lineWidth": 1, "lineWidth": 1,
"pointSize": 5, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "scaleDistribution": { "type": "linear" },
"showPoints": "auto", "showPoints": "never",
"showValues": false, "showValues": false,
"spanNulls": false, "spanNulls": false,
"stacking": { "group": "A", "mode": "none" }, "stacking": { "group": "A", "mode": "normal" },
"thresholdsStyle": { "mode": "off" } "thresholdsStyle": { "mode": "off" }
}, },
"mappings": [], "mappings": [],
"max": 1,
"min": 0,
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ "color": "green", "value": 0 }, { "color": "green", "value": 0 },
{ "color": "red", "value": 80 } { "color": "red", "value": 80 }
] ]
} },
"unit": "percentunit"
}, },
"overrides": [] "overrides": []
}, },
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 1 }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 1 },
"id": 11,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
"tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" }
},
"pluginVersion": "12.4.1",
"targets": [
{
"datasource": { "type": "prometheus", "uid": "$datasource" },
"expr": "(
(1 - sum without (mode) (rate(node_cpu_seconds_total{job=\"node-exporter\", mode=~\"idle|iowait|steal\", instance=\"$instance\", cluster=~\"$cluster\"}[$__rate_interval])))
/ ignoring(cpu) group_left
count without (cpu, mode) (node_cpu_seconds_total{job=\"node-exporter\", mode=\"idle\", instance=\"$instance\", cluster=~\"$cluster\"})
)
",
"intervalFactor": 5,
"legendFormat": "{{cpu}}",
"refId": "A"
}
],
"title": "CPU Usage",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "${datasource}" },
"fieldConfig": {
"defaults": {
"color": { "mode": "palette-classic" },
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": { "type": "linear" },
"showPoints": "never",
"showValues": false,
"spanNulls": false,
"stacking": { "group": "A", "mode": "normal" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": 0 },
{ "color": "red", "value": 80 }
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 1 },
"id": 12,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
"tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" }
},
"pluginVersion": "12.4.1",
"targets": [
{
"datasource": { "type": "prometheus", "uid": "$datasource" },
"expr": "(
node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}
-
node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}
-
node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}
-
node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}
)
",
"legendFormat": "memory used",
"refId": "A"
},
{
"datasource": { "type": "prometheus", "uid": "$datasource" },
"expr": "node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}",
"legendFormat": "memory buffers",
"refId": "B"
},
{
"datasource": { "type": "prometheus", "uid": "$datasource" },
"expr": "node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}",
"legendFormat": "memory cached",
"refId": "C"
},
{
"datasource": { "type": "prometheus", "uid": "$datasource" },
"expr": "node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\", cluster=~\"$cluster\"}",
"legendFormat": "memory free",
"refId": "D"
}
],
"title": "Memory Usage",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 8 },
"id": 5,
"panels": [],
"title": "Fitness",
"type": "row"
},
{
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"fieldConfig": {
"defaults": {
"color": { "mode": "palette-classic" },
"custom": {
"axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text",
"axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "barWidthFactor": 0.6,
"drawStyle": "line", "fillOpacity": 25, "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "showPoints": "auto", "showValues": false,
"spanNulls": false, "stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
},
"overrides": []
},
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 9 },
"id": 2, "id": 2,
"options": { "options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
@@ -89,68 +274,43 @@ data:
"targets": [ "targets": [
{ {
"dataset": "garmin", "dataset": "garmin",
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource", "editorMode": "code", "format": "table", "rawQuery": true,
"uid": "bfgdydx75ju2of" "rawSql": "SELECT
}, start_time AS time,
"editorMode": "code", (duration_seconds / 60) / (distance_meters / 1000) AS \"Pace (min/km)\"
"format": "table", FROM activities
"rawQuery": true, WHERE type = 'running'
"rawSql": "SELECT\n start_time AS time,\n (duration_seconds / 60) / (distance_meters / 1000) AS \"Pace (min/km)\"\nFROM activities\nWHERE type = 'running'\n AND distance_meters > 0\nORDER BY start_time", AND distance_meters > 0
ORDER BY start_time",
"refId": "A", "refId": "A",
"sql": { "sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
} }
], ],
"title": "pace", "title": "pace",
"type": "timeseries" "type": "timeseries"
}, },
{ {
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": { "mode": "palette-classic" },
"custom": { "custom": {
"axisBorderShow": false, "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text",
"axisCenteredZero": false, "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "barWidthFactor": 0.6,
"axisColorMode": "text", "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false, "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5,
"lineInterpolation": "linear", "scaleDistribution": { "type": "linear" }, "showPoints": "auto", "showValues": false,
"lineWidth": 1, "spanNulls": false, "stacking": { "group": "A", "mode": "none" },
"pointSize": 5,
"scaleDistribution": { "type": "linear" },
"showPoints": "auto",
"showValues": false,
"spanNulls": false,
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" } "thresholdsStyle": { "mode": "off" }
}, },
"mappings": [], "mappings": [],
"thresholds": { "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
"mode": "absolute",
"steps": [
{ "color": "green", "value": 0 },
{ "color": "red", "value": 80 }
]
}
}, },
"overrides": [] "overrides": []
}, },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 1 }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 9 },
"id": 4, "id": 4,
"options": { "options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
@@ -160,69 +320,44 @@ data:
"targets": [ "targets": [
{ {
"dataset": "garmin", "dataset": "garmin",
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource", "editorMode": "code", "format": "table", "rawQuery": true,
"uid": "bfgdydx75ju2of" "rawSql": "SELECT
}, start_time AS time,
"editorMode": "code", max_hr AS \"Max HR\"
"format": "table", FROM activities
"rawQuery": true, WHERE type = 'running'
"rawSql": "SELECT\n start_time AS time,\n max_hr AS \"Max HR\"\nFROM activities\nWHERE type = 'running'\n AND max_hr IS NOT NULL\nORDER BY start_time", AND max_hr IS NOT NULL
ORDER BY start_time",
"refId": "A", "refId": "A",
"sql": { "sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
} }
], ],
"title": "max hr", "title": "max hr",
"type": "timeseries" "type": "timeseries"
}, },
{ {
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": { "mode": "palette-classic" },
"custom": { "custom": {
"axisBorderShow": true, "axisBorderShow": true, "axisCenteredZero": false, "axisColorMode": "text",
"axisCenteredZero": false, "axisGridShow": false, "axisLabel": "", "axisPlacement": "auto",
"axisColorMode": "text", "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "bars",
"axisGridShow": false, "fillOpacity": 100, "gradientMode": "hue",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "hue",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false, "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5,
"lineInterpolation": "linear", "scaleDistribution": { "type": "linear" }, "showPoints": "auto", "showValues": false,
"lineWidth": 1, "spanNulls": false, "stacking": { "group": "A", "mode": "none" },
"pointSize": 5,
"scaleDistribution": { "type": "linear" },
"showPoints": "auto",
"showValues": false,
"spanNulls": false,
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" } "thresholdsStyle": { "mode": "off" }
}, },
"mappings": [], "mappings": [],
"thresholds": { "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
"mode": "absolute",
"steps": [
{ "color": "green", "value": 0 },
{ "color": "red", "value": 80 }
]
}
}, },
"overrides": [] "overrides": []
}, },
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 8 }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 16 },
"id": 1, "id": 1,
"options": { "options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true }, "legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true },
@@ -232,69 +367,43 @@ data:
"targets": [ "targets": [
{ {
"dataset": "garmin", "dataset": "garmin",
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource", "editorMode": "code", "format": "table", "rawQuery": true,
"uid": "bfgdydx75ju2of" "rawSql": "SELECT
}, start_time AS time,
"editorMode": "code", distance_meters / 1000 AS \"Distanz (km)\"
"format": "table", FROM activities
"rawQuery": true, WHERE type = 'running'
"rawSql": "SELECT\n start_time AS time,\n distance_meters / 1000 AS \"Distanz (km)\"\nFROM activities\nWHERE type = 'running'\nORDER BY start_time", ORDER BY start_time",
"refId": "A", "refId": "A",
"sql": { "sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
} }
], ],
"title": "distance", "title": "distance",
"type": "timeseries" "type": "timeseries"
}, },
{ {
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": { "mode": "palette-classic" },
"custom": { "custom": {
"axisBorderShow": true, "axisBorderShow": true, "axisCenteredZero": false, "axisColorMode": "text",
"axisCenteredZero": false, "axisGridShow": false, "axisLabel": "", "axisPlacement": "auto",
"axisColorMode": "text", "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "bars",
"axisGridShow": false, "fillOpacity": 100, "gradientMode": "hue",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "hue",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false, "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5,
"lineInterpolation": "linear", "scaleDistribution": { "type": "linear" }, "showPoints": "auto", "showValues": false,
"lineWidth": 1, "spanNulls": false, "stacking": { "group": "A", "mode": "none" },
"pointSize": 5,
"scaleDistribution": { "type": "linear" },
"showPoints": "auto",
"showValues": false,
"spanNulls": false,
"stacking": { "group": "A", "mode": "none" },
"thresholdsStyle": { "mode": "off" } "thresholdsStyle": { "mode": "off" }
}, },
"mappings": [], "mappings": [],
"thresholds": { "thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
"mode": "absolute",
"steps": [
{ "color": "green", "value": 0 },
{ "color": "red", "value": 80 }
]
}
}, },
"overrides": [] "overrides": []
}, },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 8 }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 16 },
"id": 3, "id": 3,
"options": { "options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true }, "legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true },
@@ -304,20 +413,17 @@ data:
"targets": [ "targets": [
{ {
"dataset": "garmin", "dataset": "garmin",
"datasource": { "datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"type": "grafana-postgresql-datasource", "editorMode": "code", "format": "table", "rawQuery": true,
"uid": "bfgdydx75ju2of" "rawSql": "SELECT
}, start_time AS time,
"editorMode": "code", vo2max
"format": "table", FROM activities
"rawQuery": true, WHERE type = 'running'
"rawSql": "SELECT\n start_time AS time,\n vo2max\nFROM activities\nWHERE type = 'running'\n AND vo2max IS NOT NULL\nORDER BY start_time", AND vo2max IS NOT NULL
ORDER BY start_time",
"refId": "A", "refId": "A",
"sql": { "sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
} }
], ],
"title": "vo2max", "title": "vo2max",
@@ -325,14 +431,14 @@ data:
} }
], ],
"preload": false, "preload": false,
"refresh": "30s",
"schemaVersion": 42, "schemaVersion": 42,
"tags": [], "tags": [],
"templating": { "list": [] },
"time": { "from": "now-6h", "to": "now" }, "time": { "from": "now-6h", "to": "now" },
"timepicker": {}, "timepicker": {},
"timezone": "browser", "timezone": "browser",
"title": "sportmetrics", "title": "sportmetrics",
"uid": "adgxbg7", "uid": "adgxbg7",
"version": 18, "version": 19,
"weekStart": "" "weekStart": ""
} }