2023-07-23 02:07:58 +08:00
|
|
|
wget https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz && \
|
|
|
|
tar xvfz node_exporter-*.tar.gz && \
|
|
|
|
rm node_exporter-*.tar.gz
|
|
|
|
|
|
|
|
sudo mv node_exporter-*.linux-amd64/node_exporter /usr/local/bin
|
|
|
|
rm -r node_exporter-*.linux-amd64*
|
|
|
|
|
|
|
|
sudo useradd -rs /bin/false node_exporter
|
|
|
|
|
2023-07-23 02:16:29 +08:00
|
|
|
sudo cat > /etc/systemd/system/node_exporter.service <<EOF
|
2023-07-23 02:07:58 +08:00
|
|
|
[Unit]
|
|
|
|
Description=Node Exporter
|
|
|
|
Wants=network-online.target
|
|
|
|
After=network-online.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=node_exporter
|
|
|
|
Group=node_exporter
|
|
|
|
Type=simple
|
|
|
|
Restart=on-failure
|
|
|
|
RestartSec=5s
|
|
|
|
ExecStart=/usr/local/bin/node_exporter
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl enable --now node_exporter
|
|
|
|
sudo systemctl status node_exporter
|