From 1b2a2357d119f47a6766944b95b0d8efcc7954e6 Mon Sep 17 00:00:00 2001 From: kpa39l Date: Tue, 8 Sep 2026 14:12:27 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20vps03=20=D0=B2=20WireGuard=20(10.8.0.3)?= =?UTF-8?q?=20+=20node-exporter=20+=20=D0=B4=D0=B0=D1=88=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B4=20Nodes=20(=D0=B4=D0=B8=D1=81=D0=BA=D0=B8/=D0=BF=D0=B0?= =?UTF-8?q?=D0=BC=D1=8F=D1=82=D1=8C/=D1=81=D0=B5=D1=82=D1=8C/=D0=B4=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=83=D0=BF=D0=BD=D0=BE=D1=81=D1=82=D1=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EXPERIENCE.md | 27 +- grafana/dashboards/nodes.json | 531 ++++++++++++++++++++++++++++++++++ prometheus.yml | 9 + 3 files changed, 566 insertions(+), 1 deletion(-) create mode 100644 grafana/dashboards/nodes.json diff --git a/EXPERIENCE.md b/EXPERIENCE.md index 9620ec9..33033c6 100644 --- a/EXPERIENCE.md +++ b/EXPERIENCE.md @@ -441,10 +441,35 @@ curl -G "http://127.0.0.1:3100/loki/api/v1/query_range" \ --data-urlencode 'query={container="garage"}' --data-urlencode 'limit=3' ``` +### 25. vps03 подключён к WireGuard + node-exporter (2026-09-08) + +Задача: мониторинг vps03 (77.67.89.154, Debian 13) системных метрик +(диски/память/сеть/доступность) в Grafana, не светя порт наружу. + +- **Топология WG** (была): hub = vps01 (10.8.0.1, pubkey ZAvz4xCE…), пиры + bigbox (10.8.0.2), vps02 (10.8.0.4). Все слушают 51820. +- **Новая нода**: vps03 = **10.8.0.3**, ключ `HBTzrS86SZ+…`. vps03 инициирует + туннель к hub (Endpoint 5.129.217.146:51820, AllowedIPs 10.8.0.0/24). +- **Главный грабль:** hub видит vps03, но bigbox/vps02 НЕ могут ответить в + 10.8.0.3: WireGuard дропает пакеты, чей src-адрес не в AllowedIPs пира. + Пришлось на bigbox и vps02 **расширить AllowedIPs пира vps01** до + `10.8.0.1/32, 10.8.0.3/32` — тогда трафик к vps03 идёт через hub, а ответы + возвращаются самому vps03. (vps03 → hub работает сразу, т.к. у vps03 + AllowedIPs = 10.8.0.0/24; но в обратную сторону — нет.) +- **node-exporter на vps03**: apt install, слушает `10.8.0.3:9100` (в + /etc/default/prometheus-node-exporter: `ARGS="--web.listen-address=10.8.0.3:9100"`). + Публичный IP 77.67.89.154:9100 → connection refused (наружу не светит). +- **prometheus.yml**: job `node` получает 4-й таргет `10.8.0.3:9100` (host=vps03, + instance=vps03:9100) + relabel. +- **Дашборд**: `grafana/dashboards/nodes.json` (uid `nodes`, title "Nodes") — + 6 панелей: availability (up{job="node"}, stat), disk free GB, memory available + GB, network RX/TX B/s, load1. Provisioner импортирует автоматически. +- Проверка: `curl http://127.0.0.1:9090/api/v1/targets` → node ×4 все up. + ## Что осталось сделать / TODO - [x] Развернуть стек (docker compose up -d) в /opt/monitoring -- [x] Node-exporter на всех 3 хостах (10.8.0.x:9100) +- [x] Node-exporter на всех 4 хостах (10.8.0.x:9100; vps03 = 10.8.0.3) - [x] Дашборд Garage в Grafana (provisioning + JSON) - [x] `up{job="garage"}` в Prometheus, Grafana :3001 - [x] Логи garage через promtail → Loki → Grafana diff --git a/grafana/dashboards/nodes.json b/grafana/dashboards/nodes.json new file mode 100644 index 0000000..9bb7841 --- /dev/null +++ b/grafana/dashboards/nodes.json @@ -0,0 +1,531 @@ +{ + "annotations": { + "list": [] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "color": "red", + "text": "DOWN" + }, + "1": { + "color": "green", + "text": "UP" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "up{job=\"node\"}", + "legendFormat": "{{ host }}", + "refId": "A" + } + ], + "title": "Nodes availability", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "node_filesystem_avail_bytes{fstype!~\"tmpfs|overlay|squashfs\"} / 1024 / 1024 / 1024", + "legendFormat": "{{ host }} {{ mountpoint }}", + "refId": "A" + } + ], + "title": "Node disk free (GB)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "node_memory_MemAvailable_bytes / 1024 / 1024 / 1024", + "legendFormat": "{{ host }}", + "refId": "A" + } + ], + "title": "Memory available (GB)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "rate(node_net_bytes_rx_total[5m])", + "legendFormat": "{{ host }} RX", + "refId": "A" + } + ], + "title": "Network RX bytes/s", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "rate(node_net_bytes_tx_total[5m])", + "legendFormat": "{{ host }} TX", + "refId": "A" + } + ], + "title": "Network TX bytes/s", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "expr": "node_load1", + "legendFormat": "{{ host }}", + "refId": "A" + } + ], + "title": "Load (1m)", + "type": "timeseries" + } + ], + "refresh": "15s", + "schemaVersion": 1, + "tags": [ + "nodes" + ], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": [ + { + "refresh": "15s" + } + ], + "title": "Nodes", + "uid": "nodes", + "version": 1 +} \ No newline at end of file diff --git a/prometheus.yml b/prometheus.yml index 8a203f0..68cd39f 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -76,6 +76,10 @@ scrape_configs: - 10.8.0.4:9100 labels: host: vps02 + - targets: + - 10.8.0.3:9100 + labels: + host: vps03 relabel_configs: - source_labels: - __address__ @@ -92,6 +96,11 @@ scrape_configs: regex: 10.8.0.4:9100 target_label: instance replacement: vps02:9100 + - source_labels: + - __address__ + regex: 10.8.0.3:9100 + target_label: instance + replacement: vps03:9100 - job_name: prometheus static_configs: - targets: