bashdocker 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
中是否有名称
https://github.com/prometheus/node_exporter/releases
解压后直接运行,官方不建议在docker上运行
bashsystemctl stop firewalld #关了防火墙
tar zxvf node_exporter-1.3.1.linux-amd64.tar.gz
nohup ./node_exporter &
就可以在默认9100端口上运行监控了
https://github.com/prometheus-community/windows_exporter/releases
默认运行在9182端口上,可以在服务中看见
0.13和0.18(2022.7.21下载到的最新版本)有一些字段是不一样的比如
0.13 | 0.18 |
---|---|
windows_net_current_bandwidth | windows_net_current_bandwidth_bytes |
windows_net_packets_outbound_discarded | windows_net_packets_outbound_discarded_total |
windows_net_packets_received_errors | windows_net_packets_received_errors_total |