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,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"graphTooltip": 1,
"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": [
{
"collapsed": false,
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
"id": 5,
"id": 10,
"panels": [],
"title": "Fitness",
"title": "Cluster",
"type": "row"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"datasource": { "type": "prometheus", "uid": "${datasource}" },
"fieldConfig": {
"defaults": {
"color": { "mode": "palette-classic" },
@@ -54,7 +98,7 @@ data:
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 25,
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false },
"insertNulls": false,
@@ -62,24 +106,165 @@ data:
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": { "type": "linear" },
"showPoints": "auto",
"showPoints": "never",
"showValues": false,
"spanNulls": false,
"stacking": { "group": "A", "mode": "none" },
"stacking": { "group": "A", "mode": "normal" },
"thresholdsStyle": { "mode": "off" }
},
"mappings": [],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": 0 },
{ "color": "red", "value": 80 }
]
}
},
"unit": "percentunit"
},
"overrides": []
},
"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,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
@@ -89,68 +274,43 @@ data:
"targets": [
{
"dataset": "garmin",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"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",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"editorMode": "code", "format": "table", "rawQuery": true,
"rawSql": "SELECT
start_time AS time,
(duration_seconds / 60) / (distance_meters / 1000) AS \"Pace (min/km)\"
FROM activities
WHERE type = 'running'
AND distance_meters > 0
ORDER BY start_time",
"refId": "A",
"sql": {
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
"sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
}
],
"title": "pace",
"type": "timeseries"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"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": 0,
"gradientMode": "none",
"axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text",
"axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "barWidthFactor": 0.6,
"drawStyle": "line", "fillOpacity": 0, "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" },
"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 }
]
}
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
},
"overrides": []
},
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 1 },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 9 },
"id": 4,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true },
@@ -160,69 +320,44 @@ data:
"targets": [
{
"dataset": "garmin",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"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",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"editorMode": "code", "format": "table", "rawQuery": true,
"rawSql": "SELECT
start_time AS time,
max_hr AS \"Max HR\"
FROM activities
WHERE type = 'running'
AND max_hr IS NOT NULL
ORDER BY start_time",
"refId": "A",
"sql": {
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
"sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
}
],
"title": "max hr",
"type": "timeseries"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"fieldConfig": {
"defaults": {
"color": { "mode": "palette-classic" },
"custom": {
"axisBorderShow": true,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisGridShow": false,
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "hue",
"axisBorderShow": true, "axisCenteredZero": false, "axisColorMode": "text",
"axisGridShow": false, "axisLabel": "", "axisPlacement": "auto",
"barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "bars",
"fillOpacity": 100, "gradientMode": "hue",
"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" },
"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 }
]
}
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
},
"overrides": []
},
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 8 },
"gridPos": { "h": 7, "w": 12, "x": 0, "y": 16 },
"id": 1,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true },
@@ -232,69 +367,43 @@ data:
"targets": [
{
"dataset": "garmin",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n start_time AS time,\n distance_meters / 1000 AS \"Distanz (km)\"\nFROM activities\nWHERE type = 'running'\nORDER BY start_time",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"editorMode": "code", "format": "table", "rawQuery": true,
"rawSql": "SELECT
start_time AS time,
distance_meters / 1000 AS \"Distanz (km)\"
FROM activities
WHERE type = 'running'
ORDER BY start_time",
"refId": "A",
"sql": {
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
"sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
}
],
"title": "distance",
"type": "timeseries"
},
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"fieldConfig": {
"defaults": {
"color": { "mode": "palette-classic" },
"custom": {
"axisBorderShow": true,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisGridShow": false,
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "bars",
"fillOpacity": 100,
"gradientMode": "hue",
"axisBorderShow": true, "axisCenteredZero": false, "axisColorMode": "text",
"axisGridShow": false, "axisLabel": "", "axisPlacement": "auto",
"barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "bars",
"fillOpacity": 100, "gradientMode": "hue",
"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" },
"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 }
]
}
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": 0 }, { "color": "red", "value": 80 }] }
},
"overrides": []
},
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 8 },
"gridPos": { "h": 7, "w": 12, "x": 12, "y": 16 },
"id": 3,
"options": {
"legend": { "calcs": [], "displayMode": "list", "placement": "right", "showLegend": true },
@@ -304,20 +413,17 @@ data:
"targets": [
{
"dataset": "garmin",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "bfgdydx75ju2of"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n start_time AS time,\n vo2max\nFROM activities\nWHERE type = 'running'\n AND vo2max IS NOT NULL\nORDER BY start_time",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "bfgdydx75ju2of" },
"editorMode": "code", "format": "table", "rawQuery": true,
"rawSql": "SELECT
start_time AS time,
vo2max
FROM activities
WHERE type = 'running'
AND vo2max IS NOT NULL
ORDER BY start_time",
"refId": "A",
"sql": {
"columns": [{ "parameters": [], "type": "function" }],
"groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }],
"limit": 50
}
"sql": { "columns": [{ "parameters": [], "type": "function" }], "groupBy": [{ "property": { "type": "string" }, "type": "groupBy" }], "limit": 50 }
}
],
"title": "vo2max",
@@ -325,14 +431,14 @@ data:
}
],
"preload": false,
"refresh": "30s",
"schemaVersion": 42,
"tags": [],
"templating": { "list": [] },
"time": { "from": "now-6h", "to": "now" },
"timepicker": {},
"timezone": "browser",
"title": "sportmetrics",
"uid": "adgxbg7",
"version": 18,
"version": 19,
"weekStart": ""
}