I want to use Prometheus to monitor my docker containers. I can run Prometheus with Grafana but I do not know how to instruct it to monitor other docker containers. If possible I would like to see some example. For instance I have Ubuntu container running on my host as well as Gentoo container. How can I tell Prometheus to monitor them, or perhaps to monitor some application(s) running inside? Thanks in advance for your time and patience with me.
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
You could use cadvisor, which provides container users an understanding of the resource usage and performance characteristics of their running containers.
A very good article about setting up Prometheus to monitor Docker is using this architecture:
Briefly, the idea is to collect information about containers using cAdvisor and put them into Prometheus database. Grafana will query the Prometheus database and render monitoring charts / values.
To collect data from cAdvisor to Prometheus, you will have to edit a configuration file (
prometheus.yml
):When you have some data in Prometheus, the you have to use Grafana to view it. A (short) example of monitoring
json
queries you could import into Grafana is as follow:Get % of user CPU :
Get % of RAM used :
For complete json data (too long to be posted here), you can clone this repository :
And try to import this Grafana json.
I'm currently using this architecture to monitor a
docker swarm mode
cluster in production, and here is the output of the monitoring that you can find in the github repository.