How To Install node_exporter for Prometheus on Raspberry PI or Orange PI

Create one new user for node_exporter

sudo useradd --no-create-home --shell /bin/false node_exporter

download file

cd ~
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-armv7.tar.gz

unpack archive

tar xvf node_exporter-0.18.1.linux-armv7.tar.gz

copy files and directories

sudo cp node_exporter-0.18.1.linux-armv7/node_exporter /usr/local/bin
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

finally, delete files and directory from your home

rm -rf node_exporter-0.18.1.linux-armv7.tar.gz node_exporter-0.18.1.linux-armv7

create a new systemd service file.

sudo nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

then reload systemd, start service and check status.

sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter

change configuration in a file with named prometheus.yml:

sudo nano /etc/prometheus/prometheus.yml
global:
   scrape_interval: 15s
scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs: 
      - targets: ['localhost:9090']
  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs: 
      - targets: ['localhost:9100']   

Restart prometheus and check status.

sudo systemctl restart prometheus
sudo systemctl status prometheus
For check node_exporter, enter in the Expression field, node_memory_MemAvailable/1024/1024 and then press the Execute button.
then in console enter free -h

Leave a Reply