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 does Prometheus monitor Docker Swarm clusters

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how Prometheus monitors Docker Swarm clusters". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Introduction to cAdvisor

In order to solve the problem of container monitoring, Google developed a container monitoring tool cAdvisor (Container Advisor), which provides container users with a visual display of the resource usage and performance characteristics of their running containers. It is a running daemon that collects, aggregates, processes, and exports information about running containers.

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

CAdvisor is developed in go language. If you want to know more, please visit its official github

Install cAdvisor

CAdvisor has two ways to run, one is to install and run as a binary executable file, configure systemd to manage, the other is to run as a Docker container, using docker-compose to manage, here we only talk about docker deployment and management methods.

We can run the cAdvisor container on the virtual machine of the lab environment with the following command:

Start in Docker mode

Docker run\

-- volume=/:/rootfs:ro\

-- volume=/var/run:/var/run:rw\

-- volume=/sys:/sys:ro\

-- volume=/var/lib/docker/:/var/lib/docker:ro\

-- volume=/dev/disk/:/dev/disk:ro\

-- publish=18080:18080\

-- detach=true\

-- name=cadvisor\

Google/cadvisor:latest

The above startup methods are a bit cumbersome for management. In order to facilitate management, we use docker-compose to manage

Install docker-compose

Curl-L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname-s)-$(uname-m)"-o / usr/local/bin/docker-compose

Chmod + x / usr/local/bin/docker-compose

Mkdir-p / data/docker-monitor/

Docker-compose file

Cat > docker-compose.yml

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