Last active
August 9, 2023 13:33
-
-
Save saderi/ea80dd490badc6ab96603130507e1c97 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
# This script is used to install node_exporter on linux amd64 platform. | |
# You can run this script directly with the following command, or you can download and run it. | |
# curl -fsSL https://gist.githubusercontent.com/saderi/ea80dd490badc6ab96603130507e1c97/raw | bash - | |
set -e | |
NODE_EXPORTER_VERSION="1.6.1" | |
wget https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz | |
tar -xvf node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz | |
cp node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter /usr/local/bin/ | |
chmod +x /usr/local/bin/node_exporter | |
tee /etc/systemd/system/node_exporter.service<<EOF | |
[Unit] | |
Description=Node Exporter | |
After=network.target | |
[Service] | |
RestartSec=2 | |
Restart=always | |
Type=simple | |
ExecStart=/usr/local/bin/node_exporter | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl start node_exporter | |
systemctl enable node_exporter | |
systemctl status node_exporter --no-pager | |
rm -rf node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment