Infra Stack¶
Nota (2026-07-12): Uptime Kuma (:3001) ya no existe. Ignora sus menciones abajo.
Observability, monitoring, and management services. Always running.
| Compose file | infra/compose.yaml |
| Status | Always on (start first) |
| Dependencies | None |
Architecture¶
┌─────────────────────────────────────────────────────────────┐
│ VISUALIZATION │
│ ┌──────────────┐ ┌──────────────────┐ │
│ │ Grafana │◄─────────────────────│ Homepage │ │
│ │ :3030 │ │ :80 │ │
│ └──────┬───────┘ └──────────────────┘ │
│ │ │
│ ┌────┴────┐ │
│ ▼ ▼ │
│ ┌──────┐ ┌──────┐ │
│ │Prom. │ │ Loki │ │
│ │:9090 │ │:3101 │ │
│ └──┬───┘ └──┬───┘ │
│ │ │ │
└────┼────────┼───────────────────────────────────────────────┘
│ │
┌────┼────────┼───────────────────────────────────────────────┐
│ │ DATA COLLECTION │
│ │ │ │
│ │ ┌────┴────┐ │
│ │ │Promtail │ ── Logs from containers & /var/log │
│ │ └─────────┘ │
│ │ │
│ ├──────┬──────────┐ │
│ ▼ ▼ ▼ │
│ ┌──────┐ ┌────────┐ ┌──────────┐ │
│ │Node │ │cAdvisor│ │Speedtest │ │
│ │Exp. │ │ :8084 │ │ :8765 │ │
│ │:9100 │ └────────┘ └──────────┘ │
│ └──────┘ │
└──────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ MANAGEMENT │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Dockge │ │ Watchtower │ │ Uptime Kuma │ │
│ │ :5001 │ │ (no port) │ │ :3001 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘
Services¶
Metrics Collection¶
| Service | Port | Purpose |
|---|---|---|
| Prometheus | 9090 | Time-series metrics database |
| Node Exporter | 9100 | Host metrics (CPU, memory, disk) |
| cAdvisor | 8084 | Container metrics |
| Speedtest Tracker | 8765 | Internet speed history |
Prometheus config: /home/monxas/appdata/prometheus/prometheus.yml
Network mode: Host network (for direct access to node-exporter)
Current scrape targets:
- localhost:9090 - Self
- localhost:9100 - Node exporter (host network)
- 192.168.0.208:8084 - cAdvisor
- 192.168.0.171:8123 - Home Assistant
- 192.168.0.208:8765 - Speedtest tracker
- 192.168.0.208:8086 - Plundrio-scanner
- 192.168.0.208:8087 - Plundrio-hunter
Turbo-boosted settings: - Retention: 30 days / 5GB max - cAdvisor housekeeping: 30s (reduced CPU) - Node-exporter: 20+ collectors disabled (arp, bcache, bonding, btrfs, infiniband, ipvs, mdadm, nfs, nfsd, rapl, schedstat, sockstat, etc.)
Alert Rules: /home/monxas/appdata/prometheus/alerts.yml
No versionado
Este fichero vive sólo en media-208 y no está gestionado por Ansible. Edítalo en
caliente, valida con docker exec prometheus promtool check rules /etc/prometheus/alerts.yml
y recarga con curl -X POST http://localhost:9090/-/reload.
41 reglas en 6 grupos por dominio: host_system (7), nas_health (5), nas_storage (7),
nas_smart (15), backup (2), services (5). El desglose completo y el reparto con Grafana
están en Alerting flow.
Grupo host_system:
- HighDiskUsage (warning at 80%, <20% free)
- CriticalDiskUsage (critical at 90%, <10% free)
- HighMemoryUsage (>90%, con el ARC de ZFS sumado a MemAvailable en los nodos Proxmox)
- LowMemoryAvailable (critical, <10% de MemTotal; umbral relativo)
- SwapNearlyFull (>85% y con presión de memoria real, PSI > 0.05)
- ContainerDown (todas las instancias de un job caídas >2min — no cubre
proxmox-nodes; para caída de un target suelto estáprom-target-downen Grafana) - HighLoadAverage (15min load >2 per core, excluye los jobs LXC
tv-gw|n8n-node|ha-ml-node)
Por qué esas tres salvedades (2026-07-26)¶
Las reglas ingenuas generaban ~20 falsos positivos diarios en pmx-50 (113 HighMemoryUsage +
31 SwapNearlyFull en 7 días) con la PSI de memoria en ~0. Tres artefactos de medición:
MemAvailableno contabiliza el ARC de ZFS. Es memoria reclamable al instante, pero Linux no la reporta como disponible: sobreestimaba el uso de pmx-50 en ~14 puntos (87% vs 69% real). Por esoHighMemoryUsageyLowMemoryAvailablesumannode_zfs_arc_size.- zram está diseñado para ir lleno. En pmx-50 el swap total es 4.3 GiB de zram + 2 GiB de
disco, así que un zram lleno ya fija un suelo del 68% de swap usado.
SwapNearlyFullexige además PSI real, que es el único síntoma que distingue "swap lleno" de "swap doliendo". - Los LXC sin
lxcfs -lleen/proc/loadavgdel host. Su loadavg es un duplicado del de pmx-50/51 y no dice nada del contenedor. El resto de métricas del LXC (CPU, memoria) sí son container-scoped vía lxcfs, así que para vigilar contenedores usa CPU, no load.
Umbrales absolutos aplicados a contenedores pequeños son la misma clase de error: el antiguo
LowMemoryAvailable < 600 MB era inalcanzable por construcción en el LXC 200 (n8n, límite
1 GiB), y disparaba en bucle.
Regla general: en pmx-50 el único síntoma que importa es /proc/pressure/memory. Los
porcentajes de RAM y swap no significan nada en un host con ZFS + zram + sobreasignación
intencionada (~44 GiB asignados entre VMs y LXCs sobre 28 GiB físicos).
Log Aggregation¶
| Service | Port | Purpose |
|---|---|---|
| Loki | 3101 | Log storage and querying |
| Promtail | - | Log collector (ships to Loki) |
Promtail config: /home/monxas/appdata/promtail/config.yml
Collects:
- /var/log/* - System logs
- Docker container logs via labels
Visualization¶
| Service | Port | Purpose |
|---|---|---|
| Grafana | 3030 | Dashboards and alerting |
| Homepage | 80 | Static dashboard (nginx) |
Grafana data: /home/monxas/appdata/grafana/
Security¶
| Service | Port | Purpose |
|---|---|---|
| Krawl | 5050 | Honeypot & IP analysis |
Krawl serves fake admin/login pages to attract and log attackers. Exposed via 8 Cloudflare Tunnel subdomains: admin, panel, login, phpmyadmin, wp-admin, cpanel, webmail, dashboard (all *.monxas.casa).
Dashboard: https://admin.monxas.casa/krawl-dashboard
Data: /home/monxas/appdata/krawl/
Management & Monitoring¶
| Service | Port | Purpose |
|---|---|---|
| Dockge | 5001 | Docker Compose UI |
| Watchtower | - | Auto-updates containers at 4 AM |
| Uptime Kuma | 3001 | Uptime monitoring with alerts |
Watchtower settings:
- Schedule: Daily at 4:00 AM (0 0 4 * * *)
- Only updates containers with label com.centurylinklabs.watchtower.enable=true
- Sends notifications to ntfy
Data Retention¶
| Service | Retention | Location |
|---|---|---|
| Prometheus | 30 days / 5GB | /home/monxas/appdata/prometheus/data |
| Loki | Default | /home/monxas/appdata/loki |
| Grafana | Unlimited | /home/monxas/appdata/grafana |
Common Tasks¶
Check Prometheus targets:
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets[] | {job: .labels.job, health: .health}'
Query Prometheus:
# CPU usage
curl -s 'http://localhost:9090/api/v1/query?query=100-(avg(irate(node_cpu_seconds_total{mode="idle"}[5m]))*100)'
# Memory usage
curl -s 'http://localhost:9090/api/v1/query?query=100*(1-node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes)'
Check Watchtower schedule:
Add new Prometheus target:
Edit /home/monxas/appdata/prometheus/prometheus.yml then:
Troubleshooting¶
Prometheus not scraping?
# Check target status
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets[] | select(.health != "up")'
# Check config
docker exec prometheus promtool check config /etc/prometheus/prometheus.yml
Grafana can't connect to data source?
# Test Prometheus from Grafana container
docker exec grafana curl -s http://prometheus:9090/api/v1/status/config
Logs not appearing in Loki?