Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor docker host based on prometheus

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to monitor docker hosts based on prometheus". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to monitor docker hosts based on prometheus".

Installation preparation

Docker host: 172.22.3.149

Prometheus host has installed prometheus and grafnana: reference: centos7.8 installation prometheus and grafana practice

This practice is based on prometheus to monitor existing docker hosts.

Docker install cadvisor

CAdvisor can real-time monitor and collect performance data of resources and containers on node machines, including CPU usage, memory usage, network throughput and file system usage.

We use docker installation here.

# docker run\-restart always-- privileged=true\-- volume=/:/rootfs:ro\-- volume=/var/run:/var/run:rw\-- volume=/sys:/sys:ro\-- volume=/var/lib/docker/:/var/lib/docker:ro\-- publish=9080:8080\-- detach=true\-- name=cadvisor\-v "/ etc/localtime:/etc/localtime"\ 172.22.3.141:58082/google/cadvisor:latest configure redis_exporter monitoring

Modify the prometheus configuration file prometheus.yml and add the following configuration under scrape_configs

-job_name: 'docker-host' file_sd_configs:-files: [' / opt/prometheus/sd_config/docker-hosts.yml'] refresh_interval: 5s

Add / opt/prometheus/sd_config/docker-hosts.yml file, which is as follows

Cat / opt/prometheus/sd_config/docker-hosts.yml- targets:-172.22.3.149purl 9080

Restart prometheus

# systemctl restart prometheus

Enter http://172.22.3.148:9090/targets in the browser address bar

You can see that targets has increased its monitoring of the service docker-hosts

Configure the panel to display the monitoring content of the host docker-hosts in grafana

Click the "+" button to pop up the import panel window

If you enter 13631 in the figure, click Load,grafana to import the panel numbered 13631 directly from the official website as follows

Select the data source Prometheus, continue with "Import", and display the docker monitoring interface as follows

The above is all the contents of the article "how to monitor docker hosts based on prometheus". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report