微服務(wù)、大中臺盛行的當下,容器化已經(jīng)被廣泛使用。在性能測試過(guò)程中,對容器的監控模型構建也是必不可少的。
我們性能測試監控模型的構建一直是圍繞著(zhù)Prometheus和Grafana來(lái)展開(kāi)的。她們可以快速的構建我們性能測試的絕大多數的監控模型:已介紹搭建了數據庫監控、服務(wù)器監控。思路是相同的,也可自行快速構建自己所需的監控模型。
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
以上兩個(gè)小方法都能提供容器的資源使用情況:CPU、Memory、Network、IO
原文轉自:https://www.cnblogs.com/hally/p/13021720.html