Steps to use Prometheus to Monitor Docker Applications
Step 1: Setup Prometheus on Linux and Windows
- Install Prometheus on Ubuntu by using the below command. If you want the latest version, you can get a link from the official page.
wget https://github.com/prometheus/prometheus/releases/download/v2.48.1/prometheus-2.48.1.linux-amd64.tar.gz
tar xvfz prometheus-2.48.1.linux-amd64.tar.gz
- If you are using windows then use these commands to install Prometheus.
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.49.1/prometheus-2.49.1.windows-amd64.zip
unzip prometheus-2.49.1.windows-amd64.zip
- Then you have to configure the daemon.json on Ubuntu . This will ensure docker daemon as a Prometheus target .
- In Ubuntu daemon.json is present in /etc/docker/ directory.
vi /etc/docker/daemon.json
{
"metrics-addr": "0.0.0.0:9323",
"experimental":true
}
- After editing the daemon.json you have to save and restart your docker service.
sudo service docker restart
- If you are using docker desktop on windows then you first have to open Docker desktop and then edit docker engine file .
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": true,
"metrics-addr": "0.0.0.0:9323"
}
Then you can save and restart the docker desktop .
How to use Prometheus to Monitor Docker Containerized Applications
Containerization has transformed software development by providing portability and consistency through platforms like Docker. Yet ensuring the health of those containerized applications requires monitoring. Prometheus is a monitoring tool that uses its powerful features to monitor the application and make sure that the application is in good health. In this article first, you will understand what is, and then I will guide you through the steps to monitor your Docker container by using Prometheus.