编辑
2023-07-28
运维
00
请注意,本文编写于 628 天前,最后修改于 628 天前,其中某些信息可能已经过时。

目录

Cadvisor监控docker容器踩坑
node_exporter部署
win_exporter部署

Cadvisor监控docker容器踩坑

bash
docker run \ --privileged=true \ #不加报错 --volume=/:/rootfs:ro \ #:ro代表容器只读 --volume=/var/run:/var/run:rw \ --volume=/sys/fs/cgroup:/sys/fs/cgroup: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

需要注意是否能正确拉取到容器名称 可以看container_last_seen中是否有名称

node_exporter部署

https://github.com/prometheus/node_exporter/releases 解压后直接运行,官方不建议在docker上运行

bash
systemctl stop firewalld #关了防火墙 tar zxvf node_exporter-1.3.1.linux-amd64.tar.gz nohup ./node_exporter &

就可以在默认9100端口上运行监控了

win_exporter部署

https://github.com/prometheus-community/windows_exporter/releases 默认运行在9182端口上,可以在服务中看见 服务 0.13和0.18(2022.7.21下载到的最新版本)有一些字段是不一样的比如

0.130.18
windows_net_current_bandwidthwindows_net_current_bandwidth_bytes
windows_net_packets_outbound_discardedwindows_net_packets_outbound_discarded_total
windows_net_packets_received_errorswindows_net_packets_received_errors_total