2.6 KiB
2.6 KiB
title, type, tags, date, source_file
| title | type | tags | date | source_file | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 家庭监控方案:Prometheus + Grafana + Node Exporter + cAdvisor + Blackbox | source |
|
2025-11-11 | raw/Technical/Home Office/🟠家庭监控方案:Prometheus + Grafana + Node Exporter + cAdvisor +Blackbox.md |
Summary
- 核心主题:家庭环境监控完整解决方案
- 问题域:主机监控、容器监控、服务可用性监控、日志聚合
- 方法/机制:Docker Compose一键部署Prometheus+Grafana监控栈
- 结论/价值:构建工作室级监控体系
Key Claims
- node_exporter采集主机指标(CPU/内存/磁盘/网络)
- cAdvisor采集容器资源使用情况
- blackbox_exporter探测HTTP/TCP服务可用性
- Alertmanager支持邮件/Slack/Webhook告警
Key Concepts
- 监控体系:Prometheus + Grafana核心架构
- 指标采集:Pull模式主动采集exporter数据
- 容器监控:cAdvisor监控Docker容器
- 合成监测:blackbox_exporter做主动探测
- 告警分发:Alertmanager统一告警路由
架构组件
数据采集层
| Exporter | 用途 | 端口 |
|---|---|---|
| node_exporter | 主机指标 | 9100 |
| cAdvisor | 容器指标 | 8080 |
| blackbox_exporter | HTTP/TCP探测 | 9115 |
存储层
| 组件 | 用途 |
|---|---|
| Prometheus | 时序数据库/告警规则 |
| Alertmanager | 告警分发 |
展示层
| 组件 | 用途 |
|---|---|
| Grafana | 可视化仪表盘/告警 |
推荐监控项
- 主机:CPU使用率>85%告警
- 磁盘:剩余空间<10%告警
- 内存:可用内存<15%告警
- 容器:重启次数>0告警
- HTTP:探测失败连续2分钟告警
- TLS:证书剩余<14天告警
Docker Compose部署
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
node_exporter:
image: prom/node-exporter:latest
network_mode: "host"
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
ports:
- "8080:8080"
blackbox:
image: prom/blackbox-exporter:latest
ports:
- "9115:9115"
Grafana Dashboard ID
| Dashboard | ID |
|---|---|
| Node Exporter Full | 1860 |
| cAdvisor Container Metrics | 14282 |
| Blackbox Exporter Probe | 7587 |
访问地址
- Prometheus: http://192.168.3.47:9090
- Grafana: http://192.168.3.47:3000 (admin/admin)
- cAdvisor: http://192.168.3.47:8080
- node_exporter: http://192.168.3.47:9100/metrics
- blackbox: http://192.168.3.47:9115