42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
---
|
||
title: "cAdvisor"
|
||
type: concept
|
||
tags: [container, monitoring, prometheus, docker]
|
||
sources: [家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]
|
||
last_updated: 2026-04-16
|
||
---
|
||
|
||
## Definition
|
||
cAdvisor(Container Advisor)是 Google 开发的容器指标采集器,实时采集容器(Docker)的资源使用和性能数据,提供容器级别的监控。
|
||
|
||
## Key Metrics
|
||
- **CPU**:CPU 使用率、限制、throttling
|
||
- **内存**:使用量、限制、缓存
|
||
- **网络**:入站/出站流量、丢包
|
||
- **文件系统**:容器日志大小
|
||
- **容器元数据**:镜像、启动命令、标签
|
||
|
||
## Docker 部署
|
||
```yaml
|
||
cadvisor:
|
||
image: gcr.io/cadvisor/cadvisor:latest
|
||
ports:
|
||
- "8080:8080"
|
||
volumes:
|
||
- /:/rootfs:ro
|
||
- /var/run:/var/run:ro
|
||
- /sys:/sys:ro
|
||
- /var/lib/docker/:/var/lib/docker:ro
|
||
```
|
||
|
||
## Common Alert Rules
|
||
- 容器重启次数 > 0(1 小时内)
|
||
- 容器 CPU 限制超过 90%
|
||
- 容器内存限制超过 85%
|
||
|
||
## Default Port
|
||
- 8080
|
||
|
||
## Connections
|
||
- [[cAdvisor]] ← scrapes_by ← [[Prometheus]]
|
||
- [[cAdvisor]] ← container_monitoring ← [[监控可观测性]] |