docker monitor — grafana+cAdvisor+prometheus

目標為監控所有docker container容器,主要是因為我建的大部分服務都在docker上,需要一個監控系統來除錯。

Step 1.

cAdvisor (Container Advisor) collects, aggregates, processes and exports information about running containers. For installing cAdvisor with docker;

請注意,我在server上的docker位置為 /home/docker

預設位置在 /var/lib/docker ,選錯會造成cAdvisor取不到資料

cAdvisor is now running on http://localhost:8080

Step 2.

Prometheus is an open-source system monitoring and alerting toolkit. Prometheus is very easy to setup. Firstly, we need to download the latest release of prometheus from .

首先要配置 promethus.yml,位置在 /etc/prometheus/prometheus.yml



啟用後,到http://localhost:9090 看看


Step 3.

Grafana is an open source metric analytics & visualization suite. It is used for visualizing time series data for infrastructure and application analytics. Grafana installation is very laborless, and we will run it using the official Docker container.

Grafana is running on port 3000 so, we will use http://localhost:3000 for going main page of grafana.


點選左方 「Configuration(齒輪)」> data source


選擇 Prometheus,進行相關配置,先前安裝prometheus為 [http://{your_ip}:9090,不要填localhost,因為docker](http://{your_ip}:9090,不要填localhost,因為docker container內的localhost跟實體機的localhost位置不同。

選擇下方 save and test,系統會檢查是否能連線成功。

下一步,選左方「+」> import

這裡使用 的模板

在裡面輸入 193 > Load


你就能在網頁上觀察看 docker 使用的效能與底下容器的狀態了。





NTUT CSIE | Biomedical Informatics Lab | |

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store