14.9. Prometheus node-exporter

14.9.1. Create a system user

# useradd --system --no-create-home --shell /bin/false node_exporter

14.9.2. Download Prometheus node-exporter

  • Download

  • Extract

  • Copy to /usr/local/bin

  • Set ownership and permissions

# cd /tmp
# wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz
# mv node_exporter-1.8.1.linux-amd64.tar.gz node_exporter.tar.gz
# tar -xzvf node_exporter.tar.gz
# cp node_exporter/node_exporter /usr/local/bin
# chown node_exporter:node_exporter /usr/local/bin/node_exporter

14.9.3. Modify Prometheus configuration file

# Path: /etc/prometheus/prometheus.yml

- job_name: 'node_exporter_metrics'
  scrape_interval: 5s
  static_configs:
  - targets: ['localhost:9100']

14.9.4. Systemd node-exporter service file

# Path: /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

14.9.4.1. Refresh systemd and restart Prometheus

# systemctl daemon-reload
# systemctl enable --now node_exporter
# systemctl status node_exporter
# systemctl restart prometheus

14.9.4.2. Check

http://ip:9100/

14.9.5. Grafana control panel (GUI)

You can now go to the Grafana dashboards and easily add a new dashboard for the Node Exporter program. Please make sure you choose the right Prometheus data source.