CAdvisor
Granfana
CAdvisor监控收集+InfluxDB存储数据+Granfana展示图表
新建目录 /cig
docker-compose.yml
新建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
启动docker-compose文件
docker-compose config -q # 验证docker-compose.yml文件配置,当配置正确时,不输出任何内容,当文件配置错误,输出错误信息。 docker-compose up docker ps
浏览cAdvisor 收集服务,http://ip:8080/ 第一次访问慢
cadvisor也有基础的图形展现功能,这里主要用它来作数据采集
浏览influxdb存储服务,http://ip:8083/
浏览grafana展现服务,http://ip:3000/
ip+3000端口的方式访问,默认帐户密码(admin/admin)
grafana配置
步骤:
配置数据源
选择influxdb数据源
URL用服务名去调用,尽量不写ip
用户名密码默认:root
配置面板panel
3.1
3.2
3.3
选哪种图形都可以
3.4
3.5
3.6
3.7 显示ok
到这里cAdvisor+InfluxDB+Grafana容器监控系统就部署完成了