From 8a3cbccb680cfdb65c961ff8660e757b3d47bacf Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 20 Nov 2025 20:10:14 +0100 Subject: =?UTF-8?q?Zugriffsstatistik=20f=C3=BCr=20Web-Dienste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tharos/caddy.nix | 15 +++++ tharos/dashboards/caddy.json | 133 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 tharos/dashboards/caddy.json diff --git a/tharos/caddy.nix b/tharos/caddy.nix index fc152c7..f6b0fcf 100644 --- a/tharos/caddy.nix +++ b/tharos/caddy.nix @@ -13,7 +13,22 @@ services.caddy = { enable = true; email = "redaktion@${self.domain}"; + globalConfig = '' + metrics { + per_host + } + ''; }; + services.prometheus.scrapeConfigs = [ + { + job_name = "caddy"; + static_configs = [ + { + targets = [ "localhost:2019" ]; + } + ]; + } + ]; }; vm = diff --git a/tharos/dashboards/caddy.json b/tharos/dashboards/caddy.json new file mode 100644 index 0000000..124ae07 --- /dev/null +++ b/tharos/dashboards/caddy.json @@ -0,0 +1,133 @@ +{ + "editable": true, + "id": 2, + "panels": [ + { + "id": 1, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "custom": { + "barWidthFactor": 1, + "drawStyle": "bars", + "fillOpacity": 100, + "lineWidth": 0, + "pointSize": 1, + "stacking": { + "group": "A", + "mode": "normal" + } + }, + "unit": "reqpm" + } + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 0 + }, + "interval": "1m", + "options": { + "legend": { + "showLegend": false + } + }, + "pluginVersion": "12.0.5", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "idelta(caddy_http_requests_total[1m])", + "legendFormat": "{{host}}" + } + ], + "title": "Alle Dienste" + }, + { + "id": 2, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "custom": { + "barWidthFactor": 1, + "drawStyle": "bars", + "fillOpacity": 100, + "lineWidth": 0, + "pointSize": 1, + "stacking": { + "group": "A", + "mode": "normal" + } + }, + "unit": "reqpm" + } + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 8 + }, + "interval": "1m", + "options": { + "legend": { + "showLegend": false + } + }, + "pluginVersion": "12.0.5", + "repeat": "Host", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "idelta(caddy_http_requests_total{host=~\"$Host\"}[1m])" + } + ], + "title": "$Host" + } + ], + "preload": false, + "refresh": "1m", + "schemaVersion": 41, + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "label_values(caddy_http_requests_total,host)", + "includeAll": true, + "name": "Host", + "query": { + "qryType": 1, + "query": "label_values(caddy_http_requests_total,host)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 2, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timezone": "browser", + "title": "Anfragen", + "uid": "a9e56c38-ddc3-4d10-b12b-5ed08f3c846e", + "version": 1 +} + -- cgit v1.2.3