21
性能测试之Docker监控
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.
微服务、大中台盛行的当下,容器化已经被广泛使用。在性能测试过程中,对容器的监控模型构建也是必不可少的。
我们性能测试监控模型的构建一直是围绕着Prometheus和Grafana来展开的。她们可以快速的构建我们性能测试的绝大多数的监控模型:已介绍搭建了数据库监控、服务器监控。思路是相同的,也可自行快速构建自己所需的监控模型。
Docker容器监控
效果图
安装使用
Prometheus和Grafana的安装,参阅上文
- 安装启动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
- 配置修改prometheus.yml,重启prometheus
- job_name: 'docker' static_configs: - targets: - "ip:port"
- 下载Grafana的Node Exporter仪表盘
https://grafana.com/api/dashboards/10619
- 导入仪表盘 Import dashboard
查看容器资源使用命令
docker stats
以上两个小方法都能提供容器的资源使用情况:CPU、Memory、Network、IO
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK