mkdir -p /opt/node_exporter

wget -O /tmp/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

tar -xvzf /tmp/node_exporter.tar.gz --strip-components 1 -C /opt/node_exporter

rm /tmp/node_exporter.tar.gz

cat > /etc/systemd/system/node_exporter.service <<EOF
[Unit]
Description=node_exporter Monitoring System
Documentation=node_exporter Monitoring System
 
[Service]
ExecStart=/opt/node_exporter/node_exporter --web.listen-address=:9100
 
[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl start node_exporter.service
systemctl status node_exporter.service
systemctl enable node_exporter.service

Q.E.D.


简单点,说话的方式简单点。