微服務、大中臺盛行的當下,容器化已經被廣泛使用。在性能測試過程中,對容器的監控模型構建也是必不可少的。
我們性能測試監控模型的構建一直是圍繞著Prometheus和Grafana來展開的。她們可以快速的構建我們性能測試的絕大多數的監控模型:已介紹搭建了數據庫監控、服務器監控。思路是相同的,也可自行快速構建自己所需的監控模型。
Docker容器監控
Prometheus和Grafana的安裝,參閱上文
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
- job_name: 'docker'
static_configs:
- targets:
- "ip:port"
https://grafana.com/api/dashboards/10619
docker stats
以上兩個小方法都能提供容器的資源使用情況:CPU、Memory、Network、IO
原文轉自:https://www.cnblogs.com/hally/p/13021720.html