Files
nexus/wiki/entities/cAdvisor.md
2026-04-27 16:26:34 +08:00

49 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "cAdvisor"
type: entity
tags: [monitoring, container, docker, prometheus, devops]
last_updated: 2026-04-26
---
## cAdvisor — Google 容器指标采集器
**官方网址:** https://github.com/google/cadvisor
**类型:** 开源项目 / 容器监控工具
**别名:**
- cadvisor
- Google cAdvisor
- Container Advisor
---
## Overview
cAdvisor 是 Google 开发的容器监控工具自动采集单个节点上运行的所有容器的资源使用情况CPU、内存、网络、磁盘 I/O并以 Prometheus 可抓取的格式暴露指标。
**采集指标示例:**
- `container_cpu_usage_seconds_total` — 容器 CPU 使用
- `container_memory_usage_bytes` — 容器内存使用
- `container_network_receive_bytes_total` — 容器网络接收
- `container_last_seen` — 容器最后活跃时间
- `container_restart_total` — 容器重启次数
**典型部署:**
- Docker: `gcr.io/cadvisor/cadvisor:latest`
- 端口:`8080`
- 需要挂载:`/var/run`Docker socket`/sys``/var/lib/docker/`
**关键告警规则示例:**
- 容器异常退出: `increase(container_last_seen[5m]) == 0`(容器未上报即可能已退出)
**安全注意:** 需审慎挂载 Docker socket权限等同于宿主机 root
---
## Used By
- [[家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]]
## Related Sources
- [[家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]]