1.环境
环境
|
组件
|
|
---|---|---|
192.169.XXX(zabbix-server) |
nodeExporter Prometheus server Cadvisor grafana |
|
杭州192.168.1.X |
nodeExporter Cadvisor |
2 组件作用
Prometheus server:普罗米修斯的主服务器
nodeexporter:负责收集host硬件信息和操作系统信息
CAdvisor:负责收集host上运行的容器信息
grafana:负责展示普罗米修斯监控界面
3.单机安装监控
#nodeexporter 收集硬件系统信息 docker run -d -p 9100:9100 - v /proc : /host/proc - v /sys : /host/sys - v /: /rootfs --net=host prom /node-exporter --path.procfs /host/proc --path.sysfs /host/sys --collector.filesystem.ignored- mount -points "^/(sys|proc|dev|host|etc)($|/)" #cadvisor,收集节点容器信息 docker run - v /: /rootfs :ro - v /var/run : /var/run/ :rw - v /sys : /sys :ro - v /var/lib/docker : /var/lib/docker :ro -p 8080:8080 --detach= true --name=cadvisor --net=host google /cadvisor #prometheus docker run -d -p 9090:9090 --name prometheus --net=host prom /prometheus docker exec -it prometheus /bin/sh docker cp prometheus: /etc/prometheus/prometheus .yml ./ New 修改:第29行,这里指定了promethus的监控项,包括它也会监控自己收集到的数据。 docker rm prometheus docker run -d -p 9090:9090 --name prometheus --net=host - v /root/prometheus .yml: /etc/prometheus/prometheus .yml prom /prometheus Granfana mkdir grafana-storage chmod 777 -R grafana-storage docker run -d -p 3000:3000 --name grafana - v /root/grafana-storage : /var/lib/grafana -e "GF_SECURITY_ADMIN_PASSWORD=123456" grafana /grafana |
4 cAdvisor验证
5.node Exporter
6 prometheus
7.Granfana添加数据源
8 被监控端安装(杭州)
docker run -d -p 9100:9100 - v /proc : /host/proc - v /sys : /host/sys - v /: /rootfs --net=host prom /node-exporter --path.procfs /host/proc --path.sysfs /host/sys --collector.filesystem.ignored- mount -points "^/(sys|proc|dev|host|etc)($|/)" [root@iZbp1fbq736g1rz0g0lpnmZ ~] # cat /server/tools/docker-compose.yaml cadvisor: image: google /cadvisor :latest container_name: cadvisor ports: - 8081:8080 volumes: - /: /rootfs :ro - /var/run : /var/run :rw - /sys : /sys :ro - /var/lib/docker/ : /var/lib/docker :ro - targets: [ 'localhost:9090' , 'localhost:8080' , 'localhost:9100' , '172.16.88.4:8081' , '172.16.88.4:9100' ] docker run -d -p 9090:9090 --name prometheus --net=host - v /root/prometheus .yml: /etc/prometheus/prometheus .yml prom /prometheus |