Prometheus and Grafana are great tools for both metric data collection and visualization. Using Prometheus and Grafana, here we shall create a dashboard to monitor Docker container.
Assume, we have already a setup with Grafana & Prometheus and a docker container.
To setup Prometheus & Grafana, Click here.
To setup Docker container, Click hereStep-1: Check docker service is active or not
[root@docker docker]# service docker status| grep active
Redirecting to /bin/systemctl status docker.service
Active: active (running) since Thu 2023-03-30 06:03:24 UTC; 47s ago
[root@docker docker]#
Step-2 : Add below file in docker server/ machine
vi /etc/docker/daemon.json
{
"metrics-addr" : "172.31.37.33:9393",
"experimental" : true
}
[root@docker docker]# service docker restart
Step3: Check running containers if any
[root@docker docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
deb6378efe5b ubuntu "/bin/bash" 2 minutes ago Up 6 seconds container5
e2967e62a390 ubuntu "/bin/bash" 2 minutes ago Up 14 seconds container4
d044849ad38e ubuntu "/bin/bash" 2 minutes ago Up 30 seconds container3 container1
[root@docker docker]#
Step-4: Edit prometheus.yml file and restart Prometheus service
[root@grafana ~]# cd /home/ec2-user/prometheus/prometheus_setup/
# vi prometheus.yml
static_configs:
- targets: ["localhost:9090"]
- targets: ["172.31.37.33:9100"]
- targets: ["172.31.37.33:9323"] ## added for docker
!wq!
# systemctl restart prometheus.service
Step-5 : Now connect to Prometheus server and check this target status.
It should be "Up"
Step-6: Create new dashboard/ panel
use below PromoSQL
sum by(state)(engine_daemon_container_states_containers{})
Now you will have data in your panel:
<<<<<<<<
ReplyDelete<<<<<<<<Investment is one of the best ways to achieve financial freedom. For a beginner there are so many challenges you face. It’s hard to know how to get started. Trading the Crypto market has really been a life changer for me. I almost gave up on crypto currency at some point not until I got a proficient trader Bernie Doran, he gave me all the information required to succeed in trading. I made more profit than I could ever imagine. I’m not here to converse much but to share my testimony, I invested $2000.00 and got back $21,500.00 within 5 days of investment. His strategies and signals are the best and I have gained more knowledge.
If you are new to cryptocurrency. You can reach to him on Telegram: @BERNIE_FX
Or through Email : Bernie.doranfx01@gmail.com
It persists to be unnatural that people don't know how to get back wallets, security keys, and cryptocurrencies that have been misplaced. Despite the fact I used to imagine the contrary, everything is possible when working with certified digital asset recovery developers. Have you ever experienced financial loss due to hoaxes on spurious investing portals? Feel comfortable knowing that MYSTERIOUS HACKER has the tools to help people reclaim their financial futures and corporations by recovering any money they may have sent or lost to counterfeiters. I paid a Bitcoin scammer $40,000 to assist me with a purchase after transferring him the money. I hired MYSTERIOUS HACKER when I lost communication with them, and they were successful in recovering my funds. I'm happy I stumbled onto these web professionals. Get the help you need quickly, Visit their website on: https://mysterioushacker.info and telegram: +15625539611
ReplyDelete