通过cAdvisor监控Docker性能

1. 简介

cAdvisor(Container Advisor)实现了对docker运行容器的监控,对于每个容器,它保存了资源隔离参数、历史资源使用情况、完整的历史资源使用柱状图和网络统计信息。

2. 安装

VERSION=v0.36.0 # use the latest release version from https://github.com/google/cadvisor/releases
docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  --privileged \
  --device=/dev/kmsg \
  gcr.io/cadvisor/cadvisor:$VERSION

确认容器是否启动成功

# docker ps
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                   PORTS                                            NAMES
76457d3f7369        gcr.io/cadvisor/cadvisor:v0.36.0   "/usr/bin/cadvisor -…"   5 minutes ago       Up 5 minutes (healthy)   0.0.0.0:8080->8080/tcp     

3. 查看

 

cAdvisor

4. API

  • 相关资源
# curl  http://192.168.44.141:8080/api/v2.0
Supported request types: "appmetrics,attributes,events,machine,ps,spec,stats,storage,summary,version"
  • version
# curl  -s http://192.168.44.141:8080/api/v2.0/version | jq
"v0.36.0"
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页