feat: vps03 в WireGuard (10.8.0.3) + node-exporter + дашборд Nodes (диски/память/сеть/доступность)

This commit is contained in:
kpa39l
2026-09-08 14:12:27 +00:00
parent 5ea6fd290a
commit 1b2a2357d1
3 changed files with 566 additions and 1 deletions
+26 -1
View File
@@ -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
+531
View File
@@ -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
}
+9
View File
@@ -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: