prometheus 监控有关(docker方式)
http://www.ywnds.com/?p=9668 (使用Docker安装Prometheus)
1、docker必须先安装好,不清楚自己先安装好docker-ce
不清楚,请看centOS7 安装使用docker
2、安装prometheus
docker run --name=prometheus -d -p 9090:9090 -v /data/dockerdata/prometheus-data:/prometheus-data -v /data/dockerdata/prometheus-file/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus -config.file=/etc/prometheus/prometheus.yml
3、安装node_exporter
docker run --name=node-exporter -d -p 9100:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" prom/node-exporter --collector.procfs /host/proc --collector.sysfs /host/sys --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
# 如果用docker方式安装,但没设置—net=host,在Prometheus/Grafana里将看不到网卡流量,netstat内容.
docker run -d \
--net=host \
--restart=always \
--name node-exporter \
-p 9100:9100 \
-v "/proc:/host/proc" \
-v "/sys:/host/sys" \
-v "/:/rootfs" \ prom/node-exporter \
-collector.procfs /host/proc \
-collector.sysfs /host/sys \
-collector.filesystem.ignored-mount-points"^/(sys|proc|dev|host|etc)($|/)"
4、安装cadvisor
docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8090:8080 --detach=true --name=cadvisor google/cadvisor:latest
5、安装grafana
docker run --name=grafana -d -p 3000:3000 -e "GF_SECURITY_ADMIN_PASSWORD=admin" -v /data/dockerdata/grafana_db:/var/lib/grafana grafana/grafana