Created
June 29, 2022 00:00
-
-
Save alexolinux/3e39dfc891d7b69fecc073a8c72ed092 to your computer and use it in GitHub Desktop.
Install node_exporter
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 | |
BINDIR=/tmp/binnaries | |
VERSION="1.3.1" | |
mkdir $BINDIR | |
cd $BINDIR | |
curl -LO https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz | |
tar -xf node_exporter-${VERSION}.linux-amd64.tar.gz | |
mv node_exporter-${VERSION}.linux-amd64/node_exporter /usr/local/bin/ | |
useradd -rs /bin/false node_exporter | |
echo " Creating node_exporter.service daemon file" | |
if [[ ! -e /etc/systemd/system/node_exporter.service ]]; then | |
cat <<EOF > /etc/systemd/system/node_exporter.service | |
[Unit] | |
Description=Node Exporter | |
After=network.target | |
[Service] | |
User=node_exporter | |
Group=node_exporter | |
Type=simple | |
ExecStart=/usr/local/bin/node_exporter | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
fi | |
systemctl daemon-reload && systemctl start node_exporter && systemctl status node_exporter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment