linux-docker监控方案

zabbix + docker

https://segmentfault.com/a/1190000007568413

useradd zabbix -M -s /sbin/nologin sudo usermod -aG docker zabbix /opt/soft mkdir zabbix32 cd zabbix32 svn co svn://svn.zabbix.com/branches/3.2 . ./bootstrap.sh ./configure --enable-agent --prefix=/opt/zabbix.docker make install mkdir src/modules/zabbix_module_docker cd src/modules/zabbix_module_docker wget https://raw.githubusercontent.com/monitoringartist/Zabbix-Docker-Monitoring/master/src/modules/zabbix_module_docker/zabbix_module_docker.c wget https://raw.githubusercontent.com/monitoringartist/Zabbix-Docker-Monitoring/master/src/modules/zabbix_module_docker/Makefile make mkdir /opt/zabbix.docker/module/ cp zabbix_module_docker.so /opt/zabbix.docker/module/

cAvisor+InfluxDB+Grafana

### influxdb ### [root@00 ~]# docker run -d --name influxdb --net monitor -p 8083:8083 -p 8086:8086 tutum/influxdb # 管理页面 # http://<ip>:8083/ ## # 以下可输入命令在选择框中均有提示 # 创建cadvisor 数据库 ,在输入栏中输入:CREATE DATABASE "cadvisor" 然后回车 # 查看创建的数据,在输入栏中输入: SHOW DATABASES 然后回车 # 创建grafana 连接用户,在输入栏中输入: CREATE USER "grafana" WITH PASSWORD 'xxxxxx' 然后回车 # 查看创建的用户,在输入栏输入: SHOW USERS 然后回车, ## ### cadvisor ### [root@00 ~]# docker run -d --name=cadvisor --net monitor -p 8084:8080 -v /:/rootfs:ro -v /var/run:/var/run -v /sys:/sys:ro -v /var/lib/docker:/var/lib/docker:ro google/cadvisor -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxdb:8086 # [root@00 ~]# docker run -d --name=cadvisor --net monitor -p 8084:8080 --mount type=bind,src=/,dst=/rootfs,ro --mount type=bind,src=/var/run,dst=/var/run --mount type=bind,src=/sys,dst=/sys,ro --mount type=bind,src=/var/lib/docker,dst=/var/lib/docker,ro google/cadvisor -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxdb:8086 #管理页面 #http://<ip>:8084/ ### grafana ### [root@00 ~]# docker run -d --name grafana --net monitor -p 3000:3000 grafana/grafana #管理页面 # http://<ip>:3000/