Skip to content

Instantly share code, notes, and snippets.

@Schm1tz1
Last active August 2, 2022 13:27
Show Gist options
  • Save Schm1tz1/11f3c230dc6b6fc4bd8c1cbed9902a8f to your computer and use it in GitHub Desktop.
Save Schm1tz1/11f3c230dc6b6fc4bd8c1cbed9902a8f to your computer and use it in GitHub Desktop.
Prometheus Node Exporter Installation and Validation
#!/usr/bin/env bash
# https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-armv7.tar.gz
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
tar xzvf node_exporter-1.3.1.linux-amd64.tar.gz
sudo cp node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin
sudo useradd -m -s /bin/bash node_exporter
sudo mkdir /var/lib/node_exporter
sudo chown -R node_exporter:node_exporter /var/lib/node_exporter
sudo cat << EOF > /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
[Service]
# Provide a text file location for https://github.com/fahlke/raspberrypi_exporter data with the
# --collector.textfile.directory parameter.
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/lib/node_exporter/textfile_collector
[Install]
WantedBy=multi-user.target
EOF
ls -l /var/lib/node_exporter/
sudo systemctl daemon-reload
sudo systemctl enable node_exporter.service
sudo systemctl start node_exporter.service
sudo systemctl status node_exporter.service
curl http://localhost:9100/metrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment