In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to choose a web container monitoring scheme". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to choose the web container monitoring scheme".
There are a variety of monitoring schemes for containers, with their own commands docker stats commands, Scout, Data Dog, Sysdig Cloud, Sensu Monitoring Framework, CAdvisor and so on.
Through the docker stats command, you can easily see the CPU, memory and network traffic of all containers on the current host. But the disadvantage of docker stats command is that only all the containers of the current host are counted, and the monitoring data obtained is real-time, there is no place to store, and there is no alarm function.
Docker stats
Scout, Sysdig Cloud and Data Dog all provide perfect services, but they are all managed services, and they all charge for it. Sensu Monitoring Framework is highly integrated and free, but the deployment is too complex. All in all, we chose CAdvisor as the container monitoring tool.
CAdvisor is a Google product with the advantage of open source products, complete monitoring indicators, easy deployment, and an official docker image. The disadvantage is that the integration is not high, and the data is saved locally for only 2 minutes by default. However, you can add influxDB storage data, docking Grafana display icon, more convenient to build a container monitoring system, data collection and icon display effect is good, there is almost no impact on system performance.
CAdvisor is a container resource monitoring tool, including container memory, CPU, network IO, disk IO and other monitoring. It also provides a web page to view the real-time running status of the container. CAdvisor stores 2 minutes of data by default and is only for a single physical machine. However, CAdvisor provides many data integration interfaces to support the integration of influxDB, Redis, kafka, elasticsearch and so on. You can add the corresponding configuration to send monitoring data to these databases for storage.
There are two main features of CAdvisor:
Display the monitoring data at both host and container levels
Display historical change data.
InfluxDB is an open source distributed database of timing, events and metrics written in the Goto language without external dependency.
As mentioned earlier, CAdvisor only stores data for the last 2 minutes on the machine by default. In order to persist the data and uniformly collect and display the monitoring data, you need to store the data in influxDB. InfluxDB is a temporal database, which is specially used to store timing-related data, which is very suitable for storing CAdvisor data. Moreover, CAdvisor itself provides an integration method for InfluxDB, and you can specify the configuration when the container starts.
Main functions of InfluxDB:
Based on time series, support time-related functions (such as maximum, minimum, summation, etc.)
Measurability: you can calculate large amounts of data in real time
Event-based: it supports arbitrary event data.
Main features of InfluxDB
No structure (no mode)
Can be any number of columns
Extensible
Support a series of functions such as min,max,sum,count,mean,median to facilitate statistics
Native HTTP support, built-in HTTP API
Powerful SQL-like syntax
Has its own management interface, which is easy to use.
Grafana is an open source data monitoring and analysis visualization platform, supporting a variety of data source configurations (supporting data sources including influxDB, MySQL, elasticsearch, OpenTSDB, Graphite, etc.) and rich plug-ins and template functions, supporting chart access control and alarm.
The main features of Grafana:
Flexible and rich graphical options
Can mix a variety of styles
Support for day and night mode
Multiple data sources are supported.
CAdvisor+InfluxDB+Grafana
CAdvisor: responsible for collecting container data over time
InfluxDB: responsible for storing time series data
Grafana: responsible for analyzing and displaying time series data.
Installation and deployment
Grafana is an open source tool for analyzing time series data, and the interface is professional and easy to use.
Docker run-d-p 3000 name grafana grafana/grafana 3000-v / Users/zhangxufeng/xufeng.zhang/docker/volumes/grafana:/var/lib/grafana-- link=influxdb:influxdb-- name grafana grafana/grafana
To access grafana's web service through the ip+3000 port, you need to change the admin user password for the first access. The default user name / password is admin/admin.
Google's cadvisor can be used to collect timing information about docker containers, including resource usage and performance data while the container is running
Docker run-volume=/:/rootfs:ro-volume=/var/run:/var/run:ro-volume=/sys:/sys:ro-volume=/var/lib/docker/:/var/lib/docker:ro-volume=/dev/disk/:/dev/disk:ro-volume=/cgroup:/cgroup:ro-publish=8080:8080-detach=true-privileged=true-name=cadvisor google/cadvisor:latest storage_driver=influxdb storage_driver_host=influxdb:8086 storage_driver_host=influxdb:8086 storage_driver_db=test_storage_driver_user=root storage_driver_password=root
-d: run this container in the background
-- name: start and run the name assigned by the container cadvisor
-p: map port 8080
-- mount: bind the host file directory to the container. These directories are the directory files and monitoring contents that need to be collected by cadvisor.
-storage_driver: you need to specify the storage driver, database host and database name of the cadvisro
-- name: launches the container assignment name influxdb
-p: mapped port, port 8083 is the influxdb management port, port 8086 is the data port of influxdb
-v: Mount data
-d: run this container in the background
Influxdb: if you run through this container, the default will be pull in the official docker repository.
Deploy InfluxDB services
Docker run-d-p 8083 expose 8083-- expose 8090-- expose 8099-v / Users/zhangxufeng/xufeng.zhang/docker/volumes/influxdb:/var/lib/influxdb-- hostname=influxdb-- name influx tutum/influxdb
Description
The browser visits the management side of influxdb: http://127.0.0.1:8083, and you can see the management page.
Create a database for test and a root user, which is used to configure grafana later
Docker exec-it influxdb influxCREATE DATABASE "test" CREATE USER "root" WITH PASSWORD 'root' WITH ALL PRIVILEGES
Deploy CAdvisor services
Deploy grafana services
Integrated docker-compose file
Version: '3.1'volumes: grafana_data: {} services: influxdb: image: tutum/influxdb:0.9 # image: tutum/influxdb # image: influxdb restart: always # user: environment:-PRE_CREATE_DB=cadvisor ports:-"8083 grafana_data 8086" expose:-"8090"-"8099" volumes: -. / data/influxdb:/data cadvisor: # image: Google/cadvisor:v0.29.0 image: google/cadvisor links:-influxdb:influxsrv command:-storage_driver=influxdb-storage_driver_db=cadvisor-storage_driver_host=influxsrv:8086 restart: always ports:-"8080 storage_driver_db=cadvisor 8080" volumes:-/: / rootfs:ro-/ var/run:/var/run:rw-/ sys:/sys:ro-/ var/lib/docker/:/var/lib/docker:ro grafana: # Image: grafana/grafana:2.6.0 user: image: grafana/grafana user: # user: restart: always links:-influxdb:influxsrv ports:-volumes:-grafana_data:/var/lib/grafana environment:-HTTP_USER=admin-HTTP_PASS=admin-INFLUXDB_HOST=influxsrv-INFLUXDB_PORT=8086-INFLUXDB_NAME=cadvisor-INFLUXDB_USER=root-INFLUXDB_PASS=root I believe you have a deeper understanding of "how to choose web container monitoring scheme". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.