Docker容器监控
2023-05-24 本文已影响0人
轻轻敲醒沉睡的心灵
Docker容器监控使用的是CAdvisor+InfluxDB+Granfana
:CAdvisor监控收集+InfluxDB存储数据+Granfana展示图表。
1. 写docker-compose文件
网上copy别人的,试了一下能用
version: '3.1'
volumes:
grafana_data: {}
services:
influxdb:
image: tutum/influxdb:0.9
restart: always
environment:
- PRE_CREATE_DB=cadvisor
ports:
- "8083:8083"
- "8086:8086"
volumes:
- ./data/influxdb:/data
cadvisor:
image: google/cadvisor
links:
- influxdb:influxsrv
command: -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxsrv:8086
restart: always
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
grafana:
user: "104"
image: grafana/grafana
restart: always
links:
- influxdb:influxsrv
ports:
- "3000:3000"
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
2. 检查启动测试
sudo docker compose -f d3jk.yml config -q
sudo docker compose -f d3jk.yml up
up
页面打开试了下,也可以。
cadvisor
influxdb
Granfana
详细使用自己慢慢查资料吧。