node_exporter-1.0.1.linux-amd64.tar.gz
tar -zxvf node_exporter-1.0.1.linux-amd64.tar.gz
# cd node_exporter-1.0.1.linux-amd64/
# ./node_exporter
curl http://localhost:9100/metrics
node_exporter systemctl 服务
vim /lib/systemd/system/node_exporter.service
# cat /lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter service
[Service]
User=root
ExecStart=/root/node_exporter-1.0.1.linux-amd64/node_exporter
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable node_exporter.service
systemctl start node_exporter.service
systemctl status node_exporter.service
shell脚本来配置node_exporter.service systemd
#!/bin/bash
cat > /lib/systemd/system/node_exporter.service <<EOF
[Unit]
Description=node_exporter service
[Service]
User=root
ExecStart=/root/node_exporter/node_exporter
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl start node_exporter.service
sudo systemctl enable node_exporter.service
参考: