initial commit: geekworm x1208 ups prometheus exporter

This commit is contained in:
2026-04-17 20:30:34 +02:00
commit aae6cee886
11 changed files with 389 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# Monitoring overlay for the Pi
These two files are the desired state of `/home/mokhtar/app/monitoring/` on the Pi
after the X1208 exporter is in place. The `.original` siblings are snapshots of
what's there right now (pulled with `ssh rpi cat ...`).
## Diff summary
**`compose.yaml`** — node-exporter service:
- Add volume `/var/lib/node-exporter/textfiles:/textfiles:ro`
- Add command flag `--collector.textfile.directory=/textfiles`
**`prometheus.yaml`** — global block:
- Add `external_labels: { host: rpi }` so metrics are tagged in Grafana Cloud
(instead of relying on the Docker service name as `instance`).
## Apply
```bash
scp compose.yaml prometheus.yaml rpi:/home/mokhtar/app/monitoring/
ssh rpi 'cd /home/mokhtar/app/monitoring && docker compose up -d'
```
This recreates the node-exporter container (~2s blip) and reloads Prometheus.
+42
View File
@@ -0,0 +1,42 @@
services:
node-exporter:
image: prom/node-exporter:latest
hostname: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /var/lib/node-exporter/textfiles:/textfiles:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
- '--collector.textfile.directory=/textfiles'
- '--web.telemetry-path=/_prom/metrics'
expose:
- 9100
networks:
- monitoring-network
logging:
driver: journald
options:
tag: "container-{{.Name}}"
prometheus:
image: prom/prometheus:latest
restart: unless-stopped
depends_on:
- node-exporter
volumes:
- "./prometheus.yaml:/etc/prometheus/prometheus.yml"
networks:
- monitoring-network
logging:
driver: journald
options:
tag: "container-{{.Name}}"
networks:
monitoring-network:
+16
View File
@@ -0,0 +1,16 @@
global:
scrape_interval: 60s
external_labels:
host: rpi
scrape_configs:
- job_name: scrape_mokhtar-rpi
metrics_path: /_prom/metrics
static_configs:
- targets: ['node-exporter:9100']
remote_write:
- url: 'https://prometheus-prod-39-prod-eu-north-0.grafana.net/api/prom/push'
basic_auth:
username: '1830601'
password: 'glc_eyJvIjoiNTM3NDYzIiwibiI6InN0YWNrLTEwNTY4MDYtaG0td3JpdGUtcHJvbWV0aGV1cy1ycGkiLCJrIjoidDlXblM2ME1EMTNNMEpKM2IycDBTMWt1IiwibSI6eyJyIjoicHJvZC1ldS1ub3J0aC0wIn19'