1. 安装node_exporter
$ wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
$ tar xf node_exporter-1.5.0.linux-amd64.tar.gz -C /usr/local/
$ cd /usr/local/
$ mv node_exporter-1.5.0.linux-amd64 node_exporter
2. 创建服务
$ vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
After=network.target
[Service]
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
3. 启动、开机自启
$ systemctl start node_exporter
$ systemctl enable node_exporter
4. 访问测试
浏览器访问:http://[IP]:9100/metrics