Created
November 22, 2024 00:39
-
-
Save azidanit/0ae184f48809d25912f0854a740c50d6 to your computer and use it in GitHub Desktop.
Revisions
-
azidanit created this gist
Nov 22, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz tar xvfz node_exporter-*.*-amd64.tar.gz cd node_exporter-*.*-amd64 mv node_exporter /usr/local/bin/ useradd -rs /bin/false node_exporter echo "Creating systemd service file..." cat <<EOF | tee /etc/systemd/system/node_exporter.service > /dev/null [Unit] Description=Node Exporter Documentation=https://prometheus.io/docs/guides/node-exporter/ After=network.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter Restart=on-failure [Install] WantedBy=multi-user.target EOF echo "Reloading systemd daemon..." systemctl daemon-reload echo "Enabling Node Exporter service..." systemctl enable node_exporter echo "Starting Node Exporter service..." systemctl start node_exporter # Step 5: Verify service status echo "Checking Node Exporter service status..." systemctl status node_exporter --no-pager echo "Node Exporter setup complete!"