Table of contents
- Monitor Docker Containers 🐳 with Grafana Dashboard📊
- Pre-requisites:
- Let's get started--->
- Check the logs or docker container names on Grafana UI.
- To retrieve more detailed docker container logs you need another exporter like Cadvisor to send data to Prometheus.
- Let's install Cadvisor first on your target servers--->
- Configure your Prometheus to scrap data from Cadvisor's metrics--->
- Add the below data to the above prometheus.yml file
- Check Prometheus targets updated with Cadvisor
- Now let's build our dashboard to see running container names--->
- Create a new panel and use "container_tasks_state" metrics--->
- Give proper visualization to the table with some background colour--->
- Add some metrics check for Prometheus Server and Docker host server memory utilization
- Arrange the layout of the dashboard as per your ease to monitor--->
- That's great to monitor your resources with such a wonderful dashboard ✨
- Day 75 task is complete!
Monitor Docker Containers 🐳 with Grafana Dashboard📊
Pre-requisites:
Grafana server is up and running with data source Prometheus configured.
One Linux instance to serve as a Docker Engine.
Let's get started--->
- Install Docker and start the docker service on your Linux EC2 instance (Ubuntu 20.04 LTS) and configure docker to send metrics to prometheus.
sudo apt install docker.io -y
sudo usermod -aG docker $USER
sudo reboot
sudo systemctl enable docker
sudo systemctl status docker
Create this file "/etc/docker/daemon.json" and Add the below contents
{
"metrics-addr" : "0.0.0.0:9323",
"experimental" : true
}
Create 2 Docker containers and run any basic application on those containers.
Now integrate the docker containers and share the real-time logs with Grafana.
Add your "Target machine details" to this Prometheus configuration file
Check your Prometheus server's Target section for updates
Create a dashboard for your Docker Engine to monitor containers
Check the logs or docker container names on Grafana UI.
To retrieve more detailed docker container logs you need another exporter like Cadvisor to send data to Prometheus.
Let's install Cadvisor first on your target servers--->
sudo apt install cadvisor
Configure your Prometheus to scrap data from Cadvisor's metrics--->
sudo vim /etc/prometheus/prometheus.yml
Add the below data to the above prometheus.yml
file
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'prometheus_metrics'
scrape_interval: 5s
static_configs:
- targets: ['3.237.177.101:9090']
- job_name: 'Cadvisor'
scrape_interval: 5s
static_configs:
- targets: ['44.211.96.219:8080']
Check Prometheus targets updated with Cadvisor
Now let's build our dashboard to see running container names--->
Create a new panel and use "container_tasks_state" metrics--->
Give proper visualization to the table with some background colour--->
Add some metrics check for Prometheus Server and Docker host server memory utilization
Arrange the layout of the dashboard as per your ease to monitor--->
That's great to monitor your resources with such a wonderful dashboard ✨
Happy Learning :)
Day 75 task is complete!
90DaysOfDevOps Tasks👇