diff --git a/nixos/tako/services/gitea.json b/nixos/tako/services/gitea.json new file mode 100644 index 0000000..8cfa702 --- /dev/null +++ b/nixos/tako/services/gitea.json @@ -0,0 +1,128 @@ +{ + "annotations": {"list": []}, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "type": "stat", + "title": "Version", + "gridPos": {"h": 4, "w": 4, "x": 0, "y": 0}, + "id": 1, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "/^version$/", "values": false}, "textMode": "value", "colorMode": "none", "graphMode": "none"}, + "targets": [{"expr": "gitea_build_info{instance=~\"$instance\"}", "format": "table", "instant": true, "refId": "A"}] + }, + {"type": "stat", "title": "Users", "gridPos": {"h": 4, "w": 4, "x": 4, "y": 0}, "id": 2, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_users{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Repositories", "gridPos": {"h": 4, "w": 4, "x": 8, "y": 0}, "id": 3, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_repositories{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Organizations", "gridPos": {"h": 4, "w": 4, "x": 12, "y": 0}, "id": 4, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_organizations{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Issues (open)", "gridPos": {"h": 4, "w": 4, "x": 16, "y": 0}, "id": 5, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "fieldConfig": {"defaults": {"color": {"mode": "thresholds"}, "thresholds": {"mode": "absolute", "steps": [{"color": "green"}, {"color": "yellow", "value": 10}, {"color": "red", "value": 50}]}}}, "targets": [{"expr": "gitea_issues_open{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Issues (closed)", "gridPos": {"h": 4, "w": 4, "x": 20, "y": 0}, "id": 6, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_issues_closed{instance=~\"$instance\"}", "refId": "A"}]}, + + {"type": "stat", "title": "Stars", "gridPos": {"h": 4, "w": 3, "x": 0, "y": 4}, "id": 7, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_stars{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Watches", "gridPos": {"h": 4, "w": 3, "x": 3, "y": 4}, "id": 8, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_watches{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Releases", "gridPos": {"h": 4, "w": 3, "x": 6, "y": 4}, "id": 9, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_releases{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Mirrors", "gridPos": {"h": 4, "w": 3, "x": 9, "y": 4}, "id": 10, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_mirrors{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Webhooks", "gridPos": {"h": 4, "w": 3, "x": 12, "y": 4}, "id": 11, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_webhooks{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "SSH keys", "gridPos": {"h": 4, "w": 3, "x": 15, "y": 4}, "id": 12, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_publickeys{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "OAuth apps", "gridPos": {"h": 4, "w": 3, "x": 18, "y": 4}, "id": 13, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_oauths{instance=~\"$instance\"}", "refId": "A"}]}, + {"type": "stat", "title": "Attachments", "gridPos": {"h": 4, "w": 3, "x": 21, "y": 4}, "id": 14, "datasource": {"type": "prometheus", "uid": "${datasource}"}, "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "textMode": "value", "colorMode": "value", "graphMode": "area"}, "targets": [{"expr": "gitea_attachments{instance=~\"$instance\"}", "refId": "A"}]}, + + { + "type": "timeseries", + "title": "Inventory growth", + "gridPos": {"h": 9, "w": 16, "x": 0, "y": 8}, + "id": 15, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "fieldConfig": {"defaults": {"custom": {"drawStyle": "line", "lineInterpolation": "stepAfter", "fillOpacity": 0, "showPoints": "never"}}, "overrides": []}, + "options": {"legend": {"displayMode": "table", "placement": "right", "calcs": ["lastNotNull", "max"]}, "tooltip": {"mode": "multi"}}, + "targets": [ + {"expr": "gitea_users{instance=~\"$instance\"}", "legendFormat": "users", "refId": "A"}, + {"expr": "gitea_repositories{instance=~\"$instance\"}", "legendFormat": "repos", "refId": "B"}, + {"expr": "gitea_organizations{instance=~\"$instance\"}", "legendFormat": "orgs", "refId": "C"}, + {"expr": "gitea_issues{instance=~\"$instance\"}", "legendFormat": "issues total", "refId": "D"}, + {"expr": "gitea_comments{instance=~\"$instance\"}", "legendFormat": "comments", "refId": "E"}, + {"expr": "gitea_releases{instance=~\"$instance\"}", "legendFormat": "releases", "refId": "F"} + ] + }, + { + "type": "piechart", + "title": "Issues open vs closed", + "gridPos": {"h": 9, "w": 8, "x": 16, "y": 8}, + "id": 16, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "options": {"reduceOptions": {"calcs": ["lastNotNull"]}, "pieType": "donut", "legend": {"displayMode": "list", "placement": "right", "values": ["value", "percent"]}}, + "targets": [ + {"expr": "gitea_issues_open{instance=~\"$instance\"}", "legendFormat": "open", "refId": "A"}, + {"expr": "gitea_issues_closed{instance=~\"$instance\"}", "legendFormat": "closed", "refId": "B"} + ] + }, + + { + "type": "timeseries", + "title": "Process — memory (RSS)", + "gridPos": {"h": 8, "w": 8, "x": 0, "y": 17}, + "id": 17, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "fieldConfig": {"defaults": {"unit": "bytes", "custom": {"drawStyle": "line", "fillOpacity": 10, "showPoints": "never"}}, "overrides": []}, + "options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}}, + "targets": [{"expr": "process_resident_memory_bytes{job=\"tako-applications\",instance=~\"$instance\"}", "legendFormat": "RSS", "refId": "A"}] + }, + { + "type": "timeseries", + "title": "Go — goroutines", + "gridPos": {"h": 8, "w": 8, "x": 8, "y": 17}, + "id": 18, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "fieldConfig": {"defaults": {"custom": {"drawStyle": "line", "fillOpacity": 10, "showPoints": "never"}}, "overrides": []}, + "options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}}, + "targets": [{"expr": "go_goroutines{job=\"tako-applications\",instance=~\"$instance\"}", "legendFormat": "goroutines", "refId": "A"}] + }, + { + "type": "timeseries", + "title": "Go — GC pause (p99)", + "gridPos": {"h": 8, "w": 8, "x": 16, "y": 17}, + "id": 19, + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "fieldConfig": {"defaults": {"unit": "s", "custom": {"drawStyle": "line", "fillOpacity": 10, "showPoints": "never"}}, "overrides": []}, + "options": {"legend": {"displayMode": "list", "placement": "bottom"}, "tooltip": {"mode": "single"}}, + "targets": [{"expr": "go_gc_duration_seconds{job=\"tako-applications\",quantile=\"1\",instance=~\"$instance\"}", "legendFormat": "max pause", "refId": "A"}] + } + ], + "refresh": "1m", + "schemaVersion": 39, + "tags": ["gitea"], + "templating": { + "list": [ + { + "name": "datasource", + "type": "datasource", + "query": "prometheus", + "current": {"text": "Prometheus", "value": "Prometheus"}, + "hide": 0, + "label": "Datasource" + }, + { + "name": "instance", + "type": "query", + "datasource": {"type": "prometheus", "uid": "${datasource}"}, + "query": "label_values(gitea_users, instance)", + "refresh": 2, + "multi": false, + "includeAll": false, + "current": {"text": "tako", "value": "tako"}, + "label": "Instance" + } + ] + }, + "time": {"from": "now-7d", "to": "now"}, + "timepicker": {}, + "timezone": "", + "title": "Gitea", + "uid": "gitea", + "version": 1, + "weekStart": "" +} diff --git a/nixos/tako/services/home.json b/nixos/tako/services/home.json new file mode 100644 index 0000000..fcee7ee --- /dev/null +++ b/nixos/tako/services/home.json @@ -0,0 +1,40 @@ +{ + "annotations": {"list": []}, + "editable": false, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "type": "dashlist", + "title": "All dashboards", + "gridPos": {"h": 24, "w": 24, "x": 0, "y": 0}, + "id": 1, + "options": { + "showStarred": false, + "showRecentlyViewed": false, + "showSearch": true, + "showHeadings": false, + "maxItems": 100, + "query": "", + "tags": [], + "folderId": null, + "includeVars": false, + "keepTime": false + } + } + ], + "refresh": "", + "schemaVersion": 39, + "tags": [], + "templating": {"list": []}, + "time": {"from": "now-6h", "to": "now"}, + "timepicker": {}, + "timezone": "", + "title": "Home", + "uid": "home", + "version": 1, + "weekStart": "" +} diff --git a/nixos/tako/services/monitoring.nix b/nixos/tako/services/monitoring.nix index 38f5da2..e2a525b 100644 --- a/nixos/tako/services/monitoring.nix +++ b/nixos/tako/services/monitoring.nix @@ -100,6 +100,8 @@ in { check_for_updates = false; }; + dashboards.default_home_dashboard_path = "/var/lib/grafana/dashboards/home.json"; + # SCIM and the new repository "provisioning" (Git Sync) feature toggles # both route user storage through the apiserver/unified path, which # breaks OAuth auto-create with a misleading @@ -543,6 +545,8 @@ in { sha256 = "0ibqj1zlznxp9vpj1jf6vkq8hj6rg63v7kih7s9bilq5zgqj4l3v"; }; caddyDashboard = ./caddy.json; + giteaDashboard = ./gitea.json; + homeDashboard = ./home.json; in [ "d /var/lib/grafana/dashboards 0755 grafana grafana -" "L+ /var/lib/grafana/dashboards/node-exporter-full.json - - - - ${nodeExporterFull}" @@ -553,6 +557,8 @@ in { "L+ /var/lib/grafana/dashboards/pihole.json - - - - ${piholeDashboard}" "L+ /var/lib/grafana/dashboards/harmonia.json - - - - ${harmoniaDashboard}" "L+ /var/lib/grafana/dashboards/caddy.json - - - - ${caddyDashboard}" + "L+ /var/lib/grafana/dashboards/gitea.json - - - - ${giteaDashboard}" + "L+ /var/lib/grafana/dashboards/home.json - - - - ${homeDashboard}" ]; # Open firewall ports for Prometheus to scrape exporters