Created
December 5, 2025 15:39
-
-
Save pawgajda-drs/7a8bcbab412d24eb03d0c6825651b6d9 to your computer and use it in GitHub Desktop.
Install Node Exporter
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 characters
| #!/usr/bin/env bash | |
| set -e | |
| NODE_EXPORTER_VERSION="1.10.2" | |
| NODE_EXPORTER_PLATFORM="linux-amd64" | |
| NODE_EXPORTER_CHECKSUM="c46e5b6f53948477ff3a19d97c58307394a29fe64a01905646f026ddc32cb65b" | |
| wget "https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}.tar.gz" | |
| echo "${NODE_EXPORTER_CHECKSUM} node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}.tar.gz" > node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}.tar.gz.sha256sum | |
| sha256sum --check --status "node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}.tar.gz.sha256sum" | |
| tar xvzf "node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}.tar.gz" | |
| cp "node_exporter-${NODE_EXPORTER_VERSION}.${NODE_EXPORTER_PLATFORM}/node_exporter" /usr/local/bin | |
| useradd --no-create-home --system --user-group --shell /usr/bin/false node_exporter | |
| chown node_exporter:node_exporter /usr/local/bin/node_exporter | |
| cat << EOF > /etc/systemd/system/node_exporter.service | |
| [Unit] | |
| Description=Node Exporter | |
| Wants=network.target | |
| After=network.target | |
| [Service] | |
| User=node_exporter | |
| Group=node_exporter | |
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment