21

性能测试之Docker监控

 4 years ago
source link: http://www.cnblogs.com/hally/p/13021720.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

微服务、大中台盛行的当下,容器化已经被广泛使用。在性能测试过程中,对容器的监控模型构建也是必不可少的。

我们性能测试监控模型的构建一直是围绕着Prometheus和Grafana来展开的。她们可以快速的构建我们性能测试的绝大多数的监控模型:已介绍搭建了数据库监控、服务器监控。思路是相同的,也可自行快速构建自己所需的监控模型。

Docker容器监控

效果图

3quANjq.jpg!web

安装使用

Prometheus和Grafana的安装,参阅上文

  1. 安装启动cadvisor
sudo 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=8090:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:v0.24.1
  1. 配置修改prometheus.yml,重启prometheus
- job_name: 'docker'
    static_configs:
    - targets: 
      - "ip:port"
  1. 下载Grafana的Node Exporter仪表盘
https://grafana.com/api/dashboards/10619
  1. 导入仪表盘 Import dashboard

查看容器资源使用命令

docker stats

MJJBFrf.jpg!web

以上两个小方法都能提供容器的资源使用情况:CPU、Memory、Network、IO


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK