1.原生命令
docker stats命令的结果
是什么
2.是什么
容器监控3剑客
CAdvisor监控收集+InfluxDB存储数据+Granfana展示图表
3.CAdvisor
4.InfluxDB
5.Granfana
6.总结
7.compose容器编排,一套带走
新建目录
7.1新建3件套组合的
docker-compose.yml
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
user: "104"
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
7.2启动docker-compose文件
docker-compose up
7.3查看三个服务容器是否启动
测试
浏览cAdvisor收集服务,http://ip:8080/
浏览influxdb存储服务,http://ip:8083/
浏览grafana展现服务,http://ip:3000
ip+3000端口的方式访问,默认帐户密码(admin/admin)
7.4配置步骤
7.4.1配7、置数据源
7.4.2选择influxdb数据源
7.4.3配置细节
7.4.4配置面板panel
cAdvisor+InfluxDB+Grafana容器监控系统就部署完成