docker 监控
# 安装 cadvier
版本下载
https://github.com/google/cadvisor/releases
sudo docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:ro \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
--privileged \
--device=/dev/kmsg \
-v "/etc/localtime:/etc/localtime" \
gcr.io/cadvisor/cadvisor
# web 访问
http://x.x.x.x:8080
# 节点监控
docker run -d -p 9100:9100 --name node-exporter \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
-v "/etc/localtime:/etc/localtime:rw" \
prom/node-exporter \
--path.procfs /host/proc \
--path.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
# # web 访问
http://x.x.x.x:9100
# prometheus 配置
- targets: ['x.x.x.x:8080']
labels:
instance: 'node-x.x.x.x'
role: 'test'
- targets: ['x.x.x.x:9100']
labels:
instance: 'node-x.x.x.x'
role: 'test'
# 重启服务
systemctl restart prometheus 或者 kill -SIGHUP $(pidof prometheus) (动态加载)
# 导入模板 193