監控容器服務器CPU、內存、磁盤、I/O等信息,首先須要安裝node_exporter。node_exporter的做用是用於機器系統數據收集。node
(1)下載node_exporter
https://prometheus.io/download/
shell> cd /Download/
shell> wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gzlinux
(2)解壓安裝
shell> tar -xvf node_exporter-0.18.1.linux-amd64.tar.gz
shell>cd node_exporter-0.18.1.linux-amd64
shell> mv node_exporter-0.18.1.linux-amd64 node_exporter
shell> chown -R prometheus.prometheus node_exporter
shell> systemctl restart node_exporter
shell>systemctl status node_exporter
shell>netstat -tunlp | grep node_exportergit
(3)建立systemd服務
shell>cat > /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/Download/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOFgithub
shell>systemctl daemon-reload
shell> systemctl start node_exporter #啓動node_exporter服務
shell> systemctl status node_exporter docker
(4)prometheus_server 中添加job
shell> vim /Download/prometheus/prometheus.ymlshell
shell>systemctl restart prometheus #重啓prometheus服務vim
(5)查看prometheus控制檯是否獲取到了數據
瀏覽器->x.x.x.x:9090 ->status->targets 就能夠看到所監控的node瀏覽器