refined grafana and prometheus

This commit is contained in:
2026-02-21 19:04:31 +01:00
parent d276792607
commit 6f70c5f66b
6 changed files with 239 additions and 370 deletions

View File

@@ -20,6 +20,22 @@
"graphTooltip": 0,
"id": 1,
"links": [],
"templating": {
"list": [
{
"name": "course_id",
"type": "query",
"datasource": "PostgreSQL",
"query": "SELECT id AS __value, name AS __text FROM course ORDER BY name",
"refresh": 2,
"multi": false,
"includeAll": true,
"allValue": null,
"hide": 0,
"label": "Course"
}
]
},
"panels": [
{
"datasource": "Prometheus",
@@ -68,7 +84,6 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -76,183 +91,21 @@
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "Prometheus",
"expr": "probe_success{job=\"blackbox_http\"}",
"legendFormat": "{{ instance }}",
"refId": "A"
},
{
"datasource": "Prometheus",
"expr": "probe_success{job=\"blackbox_tcp\"}",
"legendFormat": "{{ instance }}",
"refId": "B"
"refId": "A"
}
],
"title": "Service Health",
"type": "stat"
},
{
"datasource": "Prometheus",
"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",
"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
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 4
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "Prometheus",
"expr": "probe_duration_seconds{job=\"blackbox_http\"} * 1000",
"legendFormat": "{{ instance }}",
"refId": "A"
}
],
"title": "HTTP Response Time (ms)",
"type": "timeseries"
},
{
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": 0
},
{
"color": "yellow",
"value": 95
},
{
"color": "green",
"value": 99
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 4
},
"id": 3,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "Prometheus",
"expr": "avg_over_time(probe_success{job=\"blackbox_http\", instance=\"http://tutortool:5000/grafana/health\"}[24h]) * 100",
"legendFormat": "Flask App",
"refId": "A"
}
],
"title": "Uptime % (24h)",
"type": "stat"
},
{
"datasource": "PostgreSQL",
"fieldConfig": {
@@ -264,10 +117,6 @@
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
@@ -286,7 +135,6 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -294,7 +142,6 @@
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
@@ -321,10 +168,6 @@
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
@@ -343,7 +186,6 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -351,7 +193,6 @@
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
@@ -378,10 +219,6 @@
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
@@ -400,7 +237,6 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -408,7 +244,6 @@
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
@@ -456,7 +291,6 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -464,7 +298,6 @@
"fields": "",
"values": true
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
@@ -480,93 +313,6 @@
"title": "Users per Active Course",
"type": "stat"
},
{
"datasource": "PostgreSQL",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 16
},
"id": 8,
"options": {
"barRadius": 0,
"barWidth": 0.7,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"orientation": "horizontal",
"showValue": "never",
"stacking": "none",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "PostgreSQL",
"format": "table",
"rawSql": "SELECT d.name AS \"Deck\", COUNT(dt.token_id) AS \"Users\" FROM deck d JOIN course c ON d.course_id = c.id LEFT JOIN deck_token dt ON d.id = dt.deck_id WHERE c.name = 'GRNVS Tutorium SS 25' GROUP BY d.name ORDER BY regexp_replace(d.name, '\\D', '', 'g')::integer ASC NULLS LAST",
"refId": "A"
}
],
"title": "Users with Access per Deck — GRNVS Tutorium SS 25",
"type": "barchart"
},
{
"datasource": "PostgreSQL",
"fieldConfig": {
@@ -602,10 +348,6 @@
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
@@ -616,9 +358,12 @@
"h": 10,
"w": 24,
"x": 0,
"y": 26
"y": 16
},
"id": 9,
"id": 8,
"repeat": "course_id",
"repeatDirection": "v",
"maxPerRow": 1,
"options": {
"barRadius": 0,
"barWidth": 0.7,
@@ -640,46 +385,148 @@
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"orientation": "horizontal",
"showValue": "auto",
"stacking": "none",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
},
"xField": "Deck",
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "PostgreSQL",
"format": "table",
"rawSql": "SELECT d.name AS \"Deck\", COUNT(dt.token_id) AS \"Users\" FROM deck d JOIN course c ON d.course_id = c.id LEFT JOIN deck_token dt ON d.id = dt.deck_id WHERE c.name = 'IT-Sec Tutorium WS 25/26' GROUP BY d.name ORDER BY regexp_replace(d.name, '\\D', '', 'g')::integer ASC NULLS LAST",
"rawSql": "SELECT d.name AS \"Deck\", COUNT(dt.token_id) AS \"Users\" FROM deck d JOIN course c ON d.course_id = c.id LEFT JOIN deck_token dt ON d.id = dt.deck_id WHERE c.id = ${course_id} GROUP BY d.name ORDER BY regexp_replace(d.name, '\\D', '', 'g')::integer ASC NULLS LAST",
"refId": "A"
}
],
"title": "Users with Access per Deck — IT-Sec Tutorium WS 25/26",
"title": "Users with Access per Deck \u2014 $course_id",
"type": "barchart"
},
{
"datasource": "PostgreSQL",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "Views",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 100
},
"id": 10,
"repeat": "course_id",
"repeatDirection": "v",
"maxPerRow": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.3.3",
"targets": [
{
"datasource": "PostgreSQL",
"format": "time_series",
"rawSql": "SELECT date_trunc('hour', pv.viewed_at) AS time, d.name AS metric, COUNT(*) AS value FROM page_view pv JOIN deck d ON pv.deck_id = d.id JOIN course c ON d.course_id = c.id WHERE c.id = ${course_id} AND $__timeFilter(pv.viewed_at) GROUP BY 1, 2 ORDER BY 1",
"refId": "A"
}
],
"title": "Deck Views Over Time \u2014 $course_id",
"type": "timeseries"
},
{
"id": 11,
"title": "User Registrations Over Time",
"type": "timeseries",
"gridPos": { "h": 10, "w": 24, "x": 0, "y": 300 },
"datasource": "PostgreSQL",
"options": {
"legend": { "displayMode": "list", "placement": "bottom", "showLegend": false },
"tooltip": { "mode": "single", "sort": "none" }
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "bars",
"fillOpacity": 80,
"lineWidth": 1,
"showPoints": "never"
}
},
"overrides": []
},
"targets": [
{
"datasource": "PostgreSQL",
"format": "time_series",
"rawSql": "SELECT date_trunc('day', created_at) AS time, COUNT(*) AS value FROM token WHERE $__timeFilter(created_at) GROUP BY 1 ORDER BY 1",
"refId": "A"
}
]
}
],
"preload": false,
"refresh": "1m",
"schemaVersion": 42,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"from": "now-7d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Tutor Tool",
"uid": "tutor-tool",
"version": 3
"version": 5
}