[root@bogon opt]# tar xvf node_exporter-1.1.2.linux-amd64.tar.gz
[root@bogon opt]# ln -s node_exporter-1.1.2.linux-amd64 node_exporter
编写node_exporter服务脚本
cat > /usr/lib/systemd/system/node_exporter.service <<EOF
[Unit]
Description=node_exporter
Documentation=
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/node_exporter
ExecStart=/opt/node_exporter/node_exporter
ExecStop=/bin/kill -KILL \$MAINPID
ExecReload=/bin/kill -HUP \$MAINPID
KillMode=control-group
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
EOF
启动
[root@bogon opt]# systemctl enable node_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
[root@bogon opt]# systemctl start node_exporter
[root@bogon opt]# systemctl status node_exporter
浏览器访问http://192.168.0.15:9100/metrics,相关指标都已经有了。